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 67987acd5d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit c73ee5acc9)
This commit is contained in:
Victor Stinner 2020-09-07 17:27:03 +02:00 committed by GitHub
parent 4e581d64b8
commit 84105cbaa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -922,7 +922,7 @@ class IOTest(unittest.TestCase):
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())