summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_venv.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2017-02-02 19:17:02 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2017-02-02 19:17:02 (GMT)
commit993f535ae9276efc7be61fb06a67b629ff92e25d (patch)
tree787e7f5633247db55c66c6f8ddc67efb039101e8 /Lib/test/test_venv.py
parent64e91275e37d881832b7c0cacd1b45c4c4ef4ba4 (diff)
parentdb6322cb8ac1a8edede92e1aa1e3c688742a7923 (diff)
downloadcpython-993f535ae9276efc7be61fb06a67b629ff92e25d.zip
cpython-993f535ae9276efc7be61fb06a67b629ff92e25d.tar.gz
cpython-993f535ae9276efc7be61fb06a67b629ff92e25d.tar.bz2
Fixes #24875: Merged fix from 3.5.
Diffstat (limited to 'Lib/test/test_venv.py')
-rw-r--r--Lib/test/test_venv.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 0ff978f..2691632 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -330,12 +330,7 @@ class EnsurePipTest(BaseTest):
else:
self.assertTrue(os.path.exists(os.devnull))
-
- @unittest.skipUnless(threading, 'some dependencies of pip import threading'
- ' module unconditionally')
- # Issue #26610: pip/pep425tags.py requires ctypes
- @unittest.skipUnless(ctypes, 'pip requires ctypes')
- def test_with_pip(self):
+ def do_test_with_pip(self, system_site_packages):
rmtree(self.env_dir)
with EnvironmentVarGuard() as envvars:
# pip's cross-version compatibility may trigger deprecation
@@ -369,6 +364,7 @@ class EnsurePipTest(BaseTest):
# config in place to ensure we ignore it
try:
self.run_with_capture(venv.create, self.env_dir,
+ system_site_packages=system_site_packages,
with_pip=True)
except subprocess.CalledProcessError as exc:
# The output this produces can be a little hard to read,
@@ -418,9 +414,19 @@ class EnsurePipTest(BaseTest):
out = out.decode("latin-1") # Force to text, prevent decoding errors
self.assertIn("Successfully uninstalled pip", out)
self.assertIn("Successfully uninstalled setuptools", out)
- # Check pip is now gone from the virtual environment
- self.assert_pip_not_installed()
+ # Check pip is now gone from the virtual environment. This only
+ # applies in the system_site_packages=False case, because in the
+ # other case, pip may still be available in the system site-packages
+ if not system_site_packages:
+ self.assert_pip_not_installed()
+ @unittest.skipUnless(threading, 'some dependencies of pip import threading'
+ ' module unconditionally')
+ # Issue #26610: pip/pep425tags.py requires ctypes
+ @unittest.skipUnless(ctypes, 'pip requires ctypes')
+ def test_with_pip(self):
+ self.do_test_with_pip(False)
+ self.do_test_with_pip(True)
if __name__ == "__main__":
unittest.main()