diff options
author | Jannis Leidel <jannis@leidel.info> | 2012-02-16 21:09:00 +0100 |
---|---|---|
committer | Jannis Leidel <jannis@leidel.info> | 2012-02-16 21:09:00 +0100 |
commit | ee554dd82b8bc6ed9a3cf989b353126580fcc082 (patch) | |
tree | b0604f39ed465673316fe94ffa29046ed868aafc /tests/test_pip.py | |
parent | 47f1b2c2b2523469e6107cb2ef325eb61fa8fcf1 (diff) | |
parent | 40ac381fad2cc31f75014f02d3e8bf755d933abb (diff) | |
download | pip-1.1.tar.gz |
Merge branch 'release/1.1'1.1
Diffstat (limited to 'tests/test_pip.py')
-rw-r--r-- | tests/test_pip.py | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/test_pip.py b/tests/test_pip.py index ec3ebc9b1..17e8f6616 100644 --- a/tests/test_pip.py +++ b/tests/test_pip.py @@ -49,15 +49,11 @@ sys.path = [src_folder] + sys.path def create_virtualenv(where, distribute=False): - save_argv = sys.argv - - try: - import virtualenv - distribute_opt = distribute and ['--distribute'] or [] - sys.argv = ['virtualenv', '--quiet'] + distribute_opt + ['--no-site-packages', '--unzip-setuptools', where] - virtualenv.main() - finally: - sys.argv = save_argv + import virtualenv + if sys.version_info[0] > 2: + distribute = True + virtualenv.create_environment( + where, use_distribute=distribute, unzip_setuptools=True) return virtualenv.path_locations(where) @@ -293,9 +289,10 @@ class TestPipEnvironment(TestFileEnvironment): if use_distribute is None: use_distribute = os.environ.get('PIP_TEST_USE_DISTRIBUTE', False) + self.use_distribute = use_distribute # Create a virtualenv and remember where it's putting things. - virtualenv_paths = create_virtualenv(self.venv_path, distribute=use_distribute) + virtualenv_paths = create_virtualenv(self.venv_path, distribute=self.use_distribute) assert self.venv_path == virtualenv_paths[0] # sanity check @@ -329,7 +326,7 @@ class TestPipEnvironment(TestFileEnvironment): " rather than expected %r" % (pythonbin, self.bin_path/'python')) # make sure we have current setuptools to avoid svn incompatibilities - if not use_distribute: + if not self.use_distribute: install_setuptools(self) # Uninstall whatever version of pip came with the virtualenv. @@ -421,6 +418,8 @@ class FastTestPipEnvironment(TestPipEnvironment): # put the test-scratch virtualenv's bin dir first on the PATH self.environ['PATH'] = Path.pathsep.join((self.bin_path, self.environ['PATH'])) + self.use_distribute = os.environ.get('PIP_TEST_USE_DISTRIBUTE', False) + if self.root_path.exists: rmtree(self.root_path) if self.backup_path.exists: @@ -429,10 +428,8 @@ class FastTestPipEnvironment(TestPipEnvironment): demand_dirs(self.venv_path) demand_dirs(self.scratch_path) - use_distribute = os.environ.get('PIP_TEST_USE_DISTRIBUTE', False) - # Create a virtualenv and remember where it's putting things. - create_virtualenv(self.venv_path, distribute=use_distribute) + create_virtualenv(self.venv_path, distribute=self.use_distribute) demand_dirs(self.user_site_path) @@ -449,7 +446,7 @@ class FastTestPipEnvironment(TestPipEnvironment): " rather than expected %r" % (pythonbin, self.bin_path/'python')) # make sure we have current setuptools to avoid svn incompatibilities - if not use_distribute: + if not self.use_distribute: install_setuptools(self) # Uninstall whatever version of pip came with the virtualenv. @@ -468,6 +465,7 @@ class FastTestPipEnvironment(TestPipEnvironment): def __del__(self): pass # shutil.rmtree(str(self.root_path), ignore_errors=True) + def run_pip(*args, **kw): result = env.run('pip', *args, **kw) ignore = [] |