Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5550365

Browse files
committed
Fix test_subprocess so that it works when launched from another directory than
the source dist.
1 parent 0dd737b commit 5550365

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/test/test_subprocess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ def test_stderr_none(self):
142142
self.assertEqual(p.stderr, None)
143143

144144
def test_executable(self):
145-
p = subprocess.Popen(["somethingyoudonthave",
146-
"-c", "import sys; sys.exit(47)"],
145+
arg0 = os.path.join(os.path.dirname(sys.executable),
146+
"somethingyoudonthave")
147+
p = subprocess.Popen([arg0, "-c", "import sys; sys.exit(47)"],
147148
executable=sys.executable)
148149
p.wait()
149150
self.assertEqual(p.returncode, 47)

0 commit comments

Comments
 (0)