diff options
author | Tarek Ziade <tarek@ziade.org> | 2010-07-03 19:16:38 +0200 |
---|---|---|
committer | Tarek Ziade <tarek@ziade.org> | 2010-07-03 19:16:38 +0200 |
commit | 91cb8c7f93b69929938ceb8913ec4bc7bc7dd016 (patch) | |
tree | 947cf99d0a6e8b700cc4bfd1fc619562018d2b55 | |
parent | 5c7f1d086631316d3fe22e97a26b26e2c18c0a1c (diff) | |
download | external_python_setuptools-91cb8c7f93b69929938ceb8913ec4bc7bc7dd016.tar.gz external_python_setuptools-91cb8c7f93b69929938ceb8913ec4bc7bc7dd016.tar.bz2 external_python_setuptools-91cb8c7f93b69929938ceb8913ec4bc7bc7dd016.zip |
added a test for #143 now that I understand it. fixes #143
--HG--
branch : distribute
extra : rebase_source : e81153c1b0c81fe7783507553caa66c217e38ed5
-rw-r--r-- | setuptools/tests/test_easy_install.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 8caaeb87..85616605 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -205,3 +205,39 @@ class TestUserInstallTest(unittest.TestCase): cmd.args = ['py'] cmd.initialize_options() self.assertFalse(cmd.user, 'NOT user should be implied') + + def test_local_index(self): + # make sure the local index is used + # when easy_install looks for installed + # packages + new_location = tempfile.mkdtemp() + target = tempfile.mkdtemp() + egg_file = os.path.join(new_location, 'foo-1.0.egg-info') + f = open(egg_file, 'w') + try: + f.write('Name: foo\n') + except: + f.close() + + sys.path.append(target) + old_ppath = os.environ.get('PYTHONPATH') + os.environ['PYTHONPATH'] = ':'.join(sys.path) + try: + dist = Distribution() + dist.script_name = 'setup.py' + cmd = easy_install(dist) + cmd.install_dir = target + cmd.args = ['foo'] + cmd.ensure_finalized() + cmd.local_index.scan([new_location]) + res = cmd.easy_install('foo') + self.assertEquals(res.location, new_location) + finally: + sys.path.remove(target) + shutil.rmtree(new_location) + shutil.rmtree(target) + if old_ppath is not None: + os.environ['PYTHONPATH'] = old_ppath + else: + del os.environ['PYTHONPATH'] + |