summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-07-26 07:21:39 (GMT)
committerGitHub <noreply@github.com>2020-07-26 07:21:39 (GMT)
commitb1a87300a06324c9fc7d6553906ed914489465aa (patch)
tree83f82c5c71d3014ac849fd5d9129350eb178ee31 /Lib/test/test_subprocess.py
parentf117cef25b5ffc4db9fbe373ddb65e14f59f0397 (diff)
downloadcpython-b1a87300a06324c9fc7d6553906ed914489465aa.zip
cpython-b1a87300a06324c9fc7d6553906ed914489465aa.tar.gz
cpython-b1a87300a06324c9fc7d6553906ed914489465aa.tar.bz2
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608)
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 0162424..434ba56 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -376,7 +376,9 @@ class ProcessTestCase(BaseTestCase):
# 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)
@@ -385,7 +387,7 @@ class ProcessTestCase(BaseTestCase):
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.