Commit 637da2c7 authored by Jason R. Coombs's avatar Jason R. Coombs

Use tmpdir in test_local_index for brevity and isolation.

parent 58c0f878
...@@ -162,18 +162,15 @@ class TestPackageIndex: ...@@ -162,18 +162,15 @@ class TestPackageIndex:
assert url == 'https://example.com/bar' assert url == 'https://example.com/bar'
assert rev == '2995' assert rev == '2995'
def test_local_index(self): def test_local_index(self, tmpdir):
""" """
local_open should be able to read an index from the file system. local_open should be able to read an index from the file system.
""" """
f = open('index.html', 'w') index_file = tmpdir / 'index.html'
f.write('<div>content</div>') with index_file.open('w') as f:
f.close() f.write('<div>content</div>')
try: url = 'file:' + pathname2url(str(tmpdir)) + '/'
url = 'file:' + pathname2url(os.getcwd()) + '/' res = setuptools.package_index.local_open(url)
res = setuptools.package_index.local_open(url)
finally:
os.remove('index.html')
assert 'content' in res.read() assert 'content' in res.read()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment