diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-06-25 14:56:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 14:56:31 (GMT) |
commit | 700cfa8c90a90016638bac13c4efd03786b2b2a0 (patch) | |
tree | 62994f7b8d6fccd910d5f65bd6cd49a4f72bf8ae /Lib/test/test_os.py | |
parent | 8ea6353f60625c96ce96588c70ff24a77f8c71f9 (diff) | |
download | cpython-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_os.py')
-rw-r--r-- | Lib/test/test_os.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7d4376a..ef2395d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1174,7 +1174,7 @@ class WalkTests(unittest.TestCase): os.makedirs(t2_path) for path in tmp1_path, tmp2_path, tmp3_path, tmp4_path, tmp5_path: - with open(path, "x") as f: + with open(path, "x", encoding='utf-8') as f: f.write("I'm " + path + " and proud of it. Blame test_os.\n") if support.can_symlink(): @@ -2360,7 +2360,7 @@ class Win32ListdirTests(unittest.TestCase): file_name = 'FILE%d' % i file_path = os.path.join(support.TESTFN, file_name) os.makedirs(dir_path) - with open(file_path, 'w') as f: + with open(file_path, 'w', encoding='utf-8') as f: f.write("I'm %s and proud of it. Blame test_os.\n" % file_path) self.created_paths.extend([dir_name, file_name]) self.created_paths.sort() @@ -3738,7 +3738,7 @@ class PathTConverterTests(unittest.TestCase): if os.name == 'nt': bytes_fspath = bytes_filename = None else: - bytes_filename = support.TESTFN.encode('ascii') + bytes_filename = os.fsencode(support.TESTFN) bytes_fspath = FakePath(bytes_filename) fd = os.open(FakePath(str_filename), os.O_WRONLY|os.O_CREAT) self.addCleanup(support.unlink, support.TESTFN) |