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

Victor Stinner webhook-mailer at python.org
Mon Sep 7 11:27:26 EDT 2020


https://github.com/python/cpython/commit/84105cbaa395923e3584a87d67ccce72c8420bb4
commit: 84105cbaa395923e3584a87d67ccce72c8420bb4
branch: 3.8
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-09-07T17:27:03+02:00
summary:

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

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

(cherry picked from commit 67987acd5dc9776f55f4e139e2b3d9e7a6434d9f)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>
(cherry picked from commit c73ee5acc96b4bbd6885156883b224b8cc3e470c)

files:
M Lib/test/test_io.py

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



More information about the Python-checkins mailing list