Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(124861)

Unified Diff: Lib/test/test_venv.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_uuid.py ('k') | Lib/test/test_webbrowser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_venv.py Tue Mar 01 10:26:10 2016 +0200
+++ b/Lib/test/test_venv.py Wed Mar 02 00:01:35 2016 +0000
@@ -111,16 +111,17 @@ class BasicTest(BaseTest):
fn = self.get_env_file(self.bindir, self.exe)
if not os.path.exists(fn): # diagnostics for Windows buildbot failures
bd = self.get_env_file(self.bindir)
print('Contents of %r:' % bd)
print(' %r' % os.listdir(bd))
self.assertTrue(os.path.exists(fn), 'File %r should exist.' % fn)
@skipInVenv
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
def test_prefixes(self):
"""
Test that the prefix values are as expected.
"""
#check our prefixes
self.assertEqual(sys.base_prefix, sys.prefix)
self.assertEqual(sys.base_exec_prefix, sys.exec_prefix)
@@ -249,30 +250,32 @@ class BasicTest(BaseTest):
if usl:
self.assertTrue(os.path.islink(fn))
# If a venv is created from a source build and that venv is used to
# run the test, the pyvenv.cfg in the venv created in the test will
# point to the venv being used to run the test, and we lose the link
# to the source build - so Python can't initialise properly.
@skipInVenv
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
def test_executable(self):
"""
Test that the sys.executable value is as expected.
"""
rmtree(self.env_dir)
self.run_with_capture(venv.create, self.env_dir)
envpy = os.path.join(os.path.realpath(self.env_dir), self.bindir, self.exe)
cmd = [envpy, '-c', 'import sys; print(sys.executable)']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
self.assertEqual(out.strip(), envpy.encode())
@unittest.skipUnless(can_symlink(), 'Needs symlinks')
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
def test_executable_symlinks(self):
"""
Test that the sys.executable value is as expected.
"""
rmtree(self.env_dir)
builder = venv.EnvBuilder(clear=True, symlinks=True)
builder.create(self.env_dir)
envpy = os.path.join(os.path.realpath(self.env_dir), self.bindir, self.exe)
@@ -281,16 +284,17 @@ class BasicTest(BaseTest):
stderr=subprocess.PIPE)
out, err = p.communicate()
self.assertEqual(out.strip(), envpy.encode())
@skipInVenv
class EnsurePipTest(BaseTest):
"""Test venv module installation of pip."""
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
def assert_pip_not_installed(self):
envpy = os.path.join(os.path.realpath(self.env_dir),
self.bindir, self.exe)
try_import = 'try:\n import pip\nexcept ImportError:\n print("OK")'
cmd = [envpy, '-c', try_import]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
@@ -319,16 +323,17 @@ class EnsurePipTest(BaseTest):
# 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"")
# Requesting pip fails without SSL (http://bugs.python.org/issue19744)
@unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE)
+ @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess.Popen()")
@unittest.skipUnless(threading, 'some dependencies of pip import threading'
' module unconditionally')
def test_with_pip(self):
rmtree(self.env_dir)
with EnvironmentVarGuard() as envvars:
# pip's cross-version compatibility may trigger deprecation
# warnings in current versions of Python. Ensure related
# environment settings don't cause venv to fail.
« no previous file with comments | « Lib/test/test_uuid.py ('k') | Lib/test/test_webbrowser.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+