summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_venv.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-25 11:30:40 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-25 11:30:40 (GMT)
commitbdc337b7a8bbe5719cf7aeab7e104262fdd741f0 (patch)
tree14184eddbcc65302db8bd94798b978d13fd02dee /Lib/test/test_venv.py
parentb347788b825feb156510d6ec321930c6044bd202 (diff)
downloadcpython-bdc337b7a8bbe5719cf7aeab7e104262fdd741f0.zip
cpython-bdc337b7a8bbe5719cf7aeab7e104262fdd741f0.tar.gz
cpython-bdc337b7a8bbe5719cf7aeab7e104262fdd741f0.tar.bz2
test_venv: enhance test_devnull()
Diffstat (limited to 'Lib/test/test_venv.py')
-rw-r--r--Lib/test/test_venv.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 09741e3..55bee23 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -39,15 +39,9 @@ except ImportError:
skipInVenv = unittest.skipIf(sys.prefix != sys.base_prefix,
'Test not appropriate in a venv')
-# os.path.exists('nul') is False: http://bugs.python.org/issue20541
-if os.devnull.lower() == 'nul':
- failsOnWindows = unittest.expectedFailure
-else:
- def failsOnWindows(f):
- return f
-
class BaseTest(unittest.TestCase):
"""Base class for venv tests."""
+ maxDiff = 80 * 50
def setUp(self):
self.env_dir = os.path.realpath(tempfile.mkdtemp())
@@ -318,16 +312,21 @@ class EnsurePipTest(BaseTest):
self.run_with_capture(venv.create, self.env_dir, with_pip=False)
self.assert_pip_not_installed()
- @failsOnWindows
- def test_devnull_exists_and_is_empty(self):
+ def test_devnull(self):
# Fix for issue #20053 uses os.devnull to force a config file to
# appear empty. However http://bugs.python.org/issue20541 means
# that doesn't currently work properly on Windows. Once that is
# fixed, the "win_location" part of test_with_pip should be restored
- self.assertTrue(os.path.exists(os.devnull))
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))
+
+
# 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'