From: Vinay Sajip Date: Thu, 2 Feb 2017 19:17:02 +0000 (+0000) Subject: Fixes #24875: Merged fix from 3.5. X-Git-Tag: v3.6.1rc1~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=993f535ae9276efc7be61fb06a67b629ff92e25d;p=python Fixes #24875: Merged fix from 3.5. --- 993f535ae9276efc7be61fb06a67b629ff92e25d diff --cc Lib/test/test_venv.py index 0ff978fc8c,c1e656613b..2691632ff4 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@@ -324,18 -327,8 +324,13 @@@ class EnsurePipTest(BaseTest) with open(os.devnull, "rb") as f: self.assertEqual(f.read(), b"") + # Issue #20541: os.path.exists('nul') is False on Windows + if os.devnull.lower() == 'nul': + self.assertFalse(os.path.exists(os.devnull)) + 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 @@@ -418,9 -412,21 +414,19 @@@ 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() - # Requesting pip fails without SSL (http://bugs.python.org/issue19744) - @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE) + @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()