summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tools
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-06-25 14:56:31 (GMT)
committerGitHub <noreply@github.com>2020-06-25 14:56:31 (GMT)
commit700cfa8c90a90016638bac13c4efd03786b2b2a0 (patch)
tree62994f7b8d6fccd910d5f65bd6cd49a4f72bf8ae /Lib/test/test_tools
parent8ea6353f60625c96ce96588c70ff24a77f8c71f9 (diff)
downloadcpython-700cfa8c90a90016638bac13c4efd03786b2b2a0.zip
cpython-700cfa8c90a90016638bac13c4efd03786b2b2a0.tar.gz
cpython-700cfa8c90a90016638bac13c4efd03786b2b2a0.tar.bz2
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035)
Diffstat (limited to 'Lib/test/test_tools')
-rw-r--r--Lib/test/test_tools/test_pathfix.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_tools/test_pathfix.py b/Lib/test/test_tools/test_pathfix.py
index 8b41930..03ed29d 100644
--- a/Lib/test/test_tools/test_pathfix.py
+++ b/Lib/test/test_tools/test_pathfix.py
@@ -30,16 +30,18 @@ class TestPathfixFunctional(unittest.TestCase):
with open(filename, 'w', encoding='utf8') as f:
f.write(f'{shebang}\n' + 'print("Hello world")\n')
+ encoding = sys.getfilesystemencoding()
proc = subprocess.run(
[sys.executable, self.script,
*pathfix_flags, '-n', pathfix_arg],
- capture_output=True, text=1)
+ env={**os.environ, 'PYTHONIOENCODING': encoding},
+ capture_output=True)
if stdout == '' and proc.returncode == 0:
stdout = f'{filename}: updating\n'
self.assertEqual(proc.returncode, exitcode, proc)
- self.assertEqual(proc.stdout, stdout, proc)
- self.assertEqual(proc.stderr, stderr, proc)
+ self.assertEqual(proc.stdout.decode(encoding), stdout.replace('\n', os.linesep), proc)
+ self.assertEqual(proc.stderr.decode(encoding), stderr.replace('\n', os.linesep), proc)
with open(filename, 'r', encoding='utf8') as f:
output = f.read()