diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-02-18 09:37:05 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-02-18 09:37:05 (GMT) |
commit | 184bdfb03a6a012ba76c43b9a8a98a67ad4d8bad (patch) | |
tree | c31d98aa5a7292f94411f467f7d2853602309b01 /Lib/test/test_subprocess.py | |
parent | a3211ee8d4d25027d75abe0bd15f28a934976b61 (diff) | |
download | cpython-184bdfb03a6a012ba76c43b9a8a98a67ad4d8bad.zip cpython-184bdfb03a6a012ba76c43b9a8a98a67ad4d8bad.tar.gz cpython-184bdfb03a6a012ba76c43b9a8a98a67ad4d8bad.tar.bz2 |
Merged revisions 78136 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78136 | ezio.melotti | 2010-02-10 23:40:33 +0200 (Wed, 10 Feb 2010) | 1 line
#7712: add a temp_cwd context manager to test_support and use it in regrtest to run all the tests in a temporary directory, saving the original CWD in test_support.SAVEDCWD. Thanks to Florent Xicluna who helped with the patch.
........
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r-- | Lib/test/test_subprocess.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index dbde4fd..0b1fe25 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -7,6 +7,7 @@ import os import tempfile import time import re +import sysconfig mswindows = (sys.platform == "win32") @@ -141,10 +142,21 @@ class ProcessTestCase(unittest.TestCase): p.wait() self.assertEqual(p.stderr, None) - def test_executable(self): - arg0 = os.path.join(os.path.dirname(sys.executable), - "somethingyoudonthave") - p = subprocess.Popen([arg0, "-c", "import sys; sys.exit(47)"], + def test_executable_with_cwd(self): + python_dir = os.path.dirname(os.path.realpath(sys.executable)) + p = subprocess.Popen(["somethingyoudonthave", "-c", + "import sys; sys.exit(47)"], + executable=sys.executable, cwd=python_dir) + p.wait() + self.assertEqual(p.returncode, 47) + + @unittest.skipIf(sysconfig.is_python_build(), + "need an installed Python. See #7774") + def test_executable_without_cwd(self): + # For a normal installation, it should work without 'cwd' + # argument. For test runs in the build directory, see #7774. + p = subprocess.Popen(["somethingyoudonthave", "-c", + "import sys; sys.exit(47)"], executable=sys.executable) p.wait() self.assertEqual(p.returncode, 47) |