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

The error is exposed on non-UTF-8 locales.
This commit is contained in:
Serhiy Storchaka 2020-07-27 20:58:35 +03:00 committed by GitHub
parent 855e68855e
commit 67987acd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

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