Skip to content

Commit

Permalink
bpo-41385: Fix test_executable_without_cwd on Windows (pythonGH-21608)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka authored and shihai1991 committed Aug 4, 2020
1 parent 004e82b commit d481884
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/test/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ def _assert_cwd(self, expected_cwd, python_arg, **kwargs):
# matches *expected_cwd*.
p = subprocess.Popen([python_arg, "-c",
"import os, sys; "
"sys.stdout.write(os.getcwd()); "
"buf = sys.stdout.buffer; "
"buf.write(os.getcwd().encode()); "
"buf.flush(); "
"sys.exit(47)"],
stdout=subprocess.PIPE,
**kwargs)
Expand All @@ -385,7 +387,7 @@ def _assert_cwd(self, expected_cwd, python_arg, **kwargs):
self.assertEqual(47, p.returncode)
normcase = os.path.normcase
self.assertEqual(normcase(expected_cwd),
normcase(p.stdout.read().decode("utf-8")))
normcase(p.stdout.read().decode()))

def test_cwd(self):
# Check that cwd changes the cwd for the child process.
Expand Down

0 comments on commit d481884

Please sign in to comment.