[Python-checkins] bpo-41401: Fix test_fspath_support in test_io. (GH-21640)

Serhiy Storchaka webhook-mailer at python.org
Mon Jul 27 13:58:47 EDT 2020


https://github.com/python/cpython/commit/67987acd5dc9776f55f4e139e2b3d9e7a6434d9f
commit: 67987acd5dc9776f55f4e139e2b3d9e7a6434d9f
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-07-27T20:58:35+03:00
summary:

bpo-41401: Fix test_fspath_support in test_io. (GH-21640)

The error is exposed on non-UTF-8 locales.

files:
M Lib/test/test_io.py

diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 18b8a7941668f..85fac30e300a6 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -928,7 +928,7 @@ def check_path_succeeds(path):
                 self.assertEqual(f.read(), "egg\n")
 
         check_path_succeeds(FakePath(os_helper.TESTFN))
-        check_path_succeeds(FakePath(os_helper.TESTFN.encode('utf-8')))
+        check_path_succeeds(FakePath(os.fsencode(os_helper.TESTFN)))
 
         with self.open(os_helper.TESTFN, "w") as f:
             bad_path = FakePath(f.fileno())



More information about the Python-checkins mailing list