summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-10-05 19:53:12 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-10-05 19:53:12 (GMT)
commit220e869a51ccf49b182ed86680cf10d077afeb36 (patch)
tree05052549859730b0da7ed4f5a49bbb9e8d2fe5fd /Lib/test
parent64478ac21940be5305d07dd30cad691941b0c384 (diff)
parent1a53c0cbf5ee97f109875ad95bdb6530b7b3022f (diff)
downloadcpython-220e869a51ccf49b182ed86680cf10d077afeb36.zip
cpython-220e869a51ccf49b182ed86680cf10d077afeb36.tar.gz
cpython-220e869a51ccf49b182ed86680cf10d077afeb36.tar.bz2
Merge issue #16115: Add test for check that executable arg to Popen() takes precedence over args[0] arg\n \n Patch by Kushal Das
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_subprocess.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 476d229..6fc6108 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -299,6 +299,16 @@ class ProcessTestCase(BaseTestCase):
# argument. For test runs in the build directory, see #7774.
self._assert_cwd('', "somethingyoudonthave", executable=sys.executable)
+ def test_executable_precedence(self):
+ # To the precedence of executable argument over args[0]
+ # For a normal installation, it should work without 'cwd'
+ # argument. For test runs in the build directory, see #7774.
+ python_dir = os.path.dirname(os.path.realpath(sys.executable))
+ p = subprocess.Popen(["nonexistent","-c",'import sys; sys.exit(42)'],
+ executable=sys.executable, cwd=python_dir)
+ p.wait()
+ self.assertEqual(p.returncode, 42)
+
def test_stdin_pipe(self):
# stdin redirection
p = subprocess.Popen([sys.executable, "-c",