[Python-checkins] [2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) (GH-7279)
Serhiy Storchaka
webhook-mailer at python.org
Thu Dec 6 04:43:40 EST 2018
https://github.com/python/cpython/commit/29a4cbff92862207eb9df9a970b3636b8b06ff5d
commit: 29a4cbff92862207eb9df9a970b3636b8b06ff5d
branch: 2.7
author: native-api <ivan_pozdeev at mail.ru>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018年12月06日T11:43:37+02:00
summary:
[2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) (GH-7279)
files:
M Lib/test/support/__init__.py
M Lib/test/test_posixpath.py
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 23b7065174ee..aaf028632a59 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -657,8 +657,12 @@ def u(s):
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:
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 0663a21ff043..18ea2e42eade 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -496,12 +496,10 @@ def test_relpath(self):
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')
More information about the Python-checkins
mailing list