]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. ...
authornative-api <ivan_pozdeev@mail.ru>
Thu, 6 Dec 2018 09:43:37 +0000 (12:43 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 6 Dec 2018 09:43:37 +0000 (11:43 +0200)
Lib/test/support/__init__.py
Lib/test/test_posixpath.py

index 23b7065174ee2cbde54dd61ebee9a8912a85832d..aaf028632a59dc1f2445d154afa67543eb096cae 100644 (file)
@@ -657,8 +657,12 @@ if have_unicode:
         unichr(0x20AC),
     ):
         try:
-            character.encode(sys.getfilesystemencoding())\
-                     .decode(sys.getfilesystemencoding())
+            # In Windows, 'mbcs' is used, and encode() returns '?'
+            # for characters missing in the ANSI codepage
+            if character.encode(sys.getfilesystemencoding())\
+                        .decode(sys.getfilesystemencoding())\
+                    != character:
+                raise UnicodeError
         except UnicodeError:
             pass
         else:
index 0663a21ff043bb37aceb768edf7f09d78be83d44..18ea2e42eadeac3f322a6a59279d8fc39d665b0d 100644 (file)
@@ -496,12 +496,10 @@ class PosixPathTest(unittest.TestCase):
         finally:
             os.getcwd = real_getcwd
 
-    @test_support.requires_unicode
+    @unittest.skipUnless(test_support.FS_NONASCII, 'need test_support.FS_NONASCII')
     def test_expandvars_nonascii_word(self):
         encoding = sys.getfilesystemencoding()
-        # Non-ASCII word characters
-        letters = test_support.u(r'\xe6\u0130\u0141\u03c6\u041a\u05d0\u062a\u0e01')
-        uwnonascii = letters.encode(encoding, 'ignore').decode(encoding)[:3]
+        uwnonascii = test_support.FS_NONASCII
         swnonascii = uwnonascii.encode(encoding)
         if not swnonascii:
             self.skipTest('Needs non-ASCII word characters')