diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-03-06 16:16:18 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-03-06 16:16:18 -0500 |
commit | ac3e0877123c9cb1a4d53653e273dfb3f1d40ed3 (patch) | |
tree | e0e6440c2b2a518c1eb0fd0edc2049e660389423 /setuptools/tests/test_easy_install.py | |
parent | 85dd199e880fdf29a2dbe25bff944b5fc3b1081e (diff) | |
download | external_python_setuptools-ac3e0877123c9cb1a4d53653e273dfb3f1d40ed3.tar.gz external_python_setuptools-ac3e0877123c9cb1a4d53653e273dfb3f1d40ed3.tar.bz2 external_python_setuptools-ac3e0877123c9cb1a4d53653e273dfb3f1d40ed3.zip |
Extract fixture for foo_package.
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r-- | setuptools/tests/test_easy_install.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 4942acbf..791e3038 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -181,17 +181,19 @@ class TestUserInstallTest: logging.basicConfig(level=logging.INFO, stream=sys.stderr) log.info('this should not break') - def test_local_index(self): + @pytest.fixture() + def foo_package(self, tmpdir): + egg_file = tmpdir / 'foo-1.0.egg-info' + with egg_file.open('w') as f: + f.write('Name: foo\n') + return str(tmpdir) + + def test_local_index(self, foo_package): """ The local index must be used when easy_install locates installed packages. """ - new_location = tempfile.mkdtemp() target = tempfile.mkdtemp() - egg_file = os.path.join(new_location, 'foo-1.0.egg-info') - with open(egg_file, 'w') as f: - f.write('Name: foo\n') - sys.path.append(target) old_ppath = os.environ.get('PYTHONPATH') os.environ['PYTHONPATH'] = os.path.pathsep.join(sys.path) @@ -202,14 +204,14 @@ class TestUserInstallTest: cmd.install_dir = target cmd.args = ['foo'] cmd.ensure_finalized() - cmd.local_index.scan([new_location]) + cmd.local_index.scan([foo_package]) res = cmd.easy_install('foo') actual = os.path.normcase(os.path.realpath(res.location)) - expected = os.path.normcase(os.path.realpath(new_location)) + expected = os.path.normcase(os.path.realpath(foo_package)) assert actual == expected finally: sys.path.remove(target) - for basedir in [new_location, target, ]: + for basedir in [target, ]: if not os.path.exists(basedir) or not os.path.isdir(basedir): continue try: |