]> granicus.if.org Git - python/commitdiff
Issue #24838: Fix test_tarfile.py for non-utf8 filesystem encodings.
authorLars Gustäbel <lars@gustaebel.de>
Tue, 19 Apr 2016 09:58:41 +0000 (11:58 +0200)
committerLars Gustäbel <lars@gustaebel.de>
Tue, 19 Apr 2016 09:58:41 +0000 (11:58 +0200)
Lib/test/test_tarfile.py

index c039f5aa75a30168d9d291890d93782549af3b35..abfb34dfb812d810eba3f116764801c25ea11c99 100644 (file)
@@ -1795,7 +1795,7 @@ class UstarUnicodeTest(UnicodeTest, unittest.TestCase):
                 self.assertRaises(exc, tar.addfile, t)
 
         if exc is None:
-            with tarfile.open(tmpname, "r") as tar:
+            with tarfile.open(tmpname, "r", encoding="utf-8") as tar:
                 for t in tar:
                     self.assertEqual(name, t.name)
                     break
@@ -1821,7 +1821,7 @@ class UstarUnicodeTest(UnicodeTest, unittest.TestCase):
                 self.assertRaises(exc, tar.addfile, t)
 
         if exc is None:
-            with tarfile.open(tmpname, "r") as tar:
+            with tarfile.open(tmpname, "r", encoding="utf-8") as tar:
                 for t in tar:
                     self.assertEqual(name, t.linkname)
                     break