aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_packageindex.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-02 11:13:12 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-02 11:13:12 -0500
commit637da2c7c72edcc5582a4892ae7e18d76910fdf5 (patch)
treef5e88d81ccffe8aa79ce244d0aea3b6cb8fe16a2 /setuptools/tests/test_packageindex.py
parent58c0f87887ee451424da702bfd70c0332e28ac5c (diff)
downloadexternal_python_setuptools-637da2c7c72edcc5582a4892ae7e18d76910fdf5.tar.gz
external_python_setuptools-637da2c7c72edcc5582a4892ae7e18d76910fdf5.tar.bz2
external_python_setuptools-637da2c7c72edcc5582a4892ae7e18d76910fdf5.zip
Use tmpdir in test_local_index for brevity and isolation.
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r--setuptools/tests/test_packageindex.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 5a46f613..098d4e3f 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -162,18 +162,15 @@ class TestPackageIndex:
assert url == 'https://example.com/bar'
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.
"""
- f = open('index.html', 'w')
- f.write('<div>content</div>')
- f.close()
- try:
- url = 'file:' + pathname2url(os.getcwd()) + '/'
- res = setuptools.package_index.local_open(url)
- finally:
- os.remove('index.html')
+ index_file = tmpdir / 'index.html'
+ with index_file.open('w') as f:
+ f.write('<div>content</div>')
+ url = 'file:' + pathname2url(str(tmpdir)) + '/'
+ res = setuptools.package_index.local_open(url)
assert 'content' in res.read()