]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17656: Skip test_extract_unicode_filenames if the FS encoding
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 8 May 2013 18:52:31 +0000 (21:52 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 8 May 2013 18:52:31 +0000 (21:52 +0300)
doesn't support non-ASCII filenames.

Lib/test/test_zipfile.py

index f960b6c7d4f6dae14cb2ae091b47506b9bd7937a..9e3a28b4383e7ffbab50eb0f1b781429f8d0d41f 100644 (file)
@@ -18,7 +18,14 @@ from tempfile import TemporaryFile
 from random import randint, random
 from unittest import skipUnless
 
-from test.test_support import TESTFN, TESTFN_UNICODE, run_unittest, findfile, unlink
+from test.test_support import TESTFN, TESTFN_UNICODE, TESTFN_ENCODING, \
+                              run_unittest, findfile, unlink
+try:
+    TESTFN_UNICODE.encode(TESTFN_ENCODING)
+except (UnicodeError, TypeError):
+    # Either the file system encoding is None, or the file name
+    # cannot be encoded in the file system encoding.
+    TESTFN_UNICODE = None
 
 TESTFN2 = TESTFN + "2"
 TESTFNDIR = TESTFN + "d"
@@ -424,6 +431,7 @@ class TestsWithSourceFile(unittest.TestCase):
         with open(filename, 'rb') as f:
             self.assertEqual(f.read(), content)
 
+    @skipUnless(TESTFN_UNICODE, "No Unicode filesystem semantics on this platform.")
     def test_extract_unicode_filenames(self):
         fnames = [u'foo.txt', os.path.basename(TESTFN_UNICODE)]
         content = 'Test for unicode filename'