bpo-37964: Make sure test works if TESTFN is in a non-ASCII directory. (GH-15568)
authorBenjamin Peterson <benjamin@python.org>
Thu, 29 Aug 2019 05:06:49 +0000 (22:06 -0700)
committerGitHub <noreply@github.com>
Thu, 29 Aug 2019 05:06:49 +0000 (22:06 -0700)
Lib/test/test_fcntl.py

index 38097dbdfb97e456de73025df1f2efcf54545171..a2b5997067539eaa4c346a19bc4be9f2396be8cf 100644 (file)
@@ -147,9 +147,9 @@ class TestFcntl(unittest.TestCase):
     @unittest.skipIf(sys.platform != 'darwin', "F_GETPATH is only available on macos")
     def test_fcntl_f_getpath(self):
         self.f = open(TESTFN, 'wb')
-        abspath = os.path.abspath(TESTFN)
-        res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(abspath)))
-        self.assertEqual(abspath, res.decode('utf-8'))
+        expected = os.path.abspath(TESTFN).encode('utf-8')
+        res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(expected)))
+        self.assertEqual(expected, res)
 
 def test_main():
     run_unittest(TestFcntl)