Issue #16115: Add test for check that executable arg to Popen() takes precedence over args[0] arg\n \n Patch by Kushal Das

This commit is contained in:
Andrew Svetlov 2012-10-05 22:52:15 +03:00
parent b28e75d9d6
commit 1a53c0cbf5
1 changed files with 10 additions and 0 deletions

View File

@ -299,6 +299,16 @@ class ProcessTestCase(BaseTestCase):
# argument. For test runs in the build directory, see #7774. # argument. For test runs in the build directory, see #7774.
self._assert_cwd('', "somethingyoudonthave", executable=sys.executable) 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): def test_stdin_pipe(self):
# stdin redirection # stdin redirection
p = subprocess.Popen([sys.executable, "-c", p = subprocess.Popen([sys.executable, "-c",