Commit 29a4cbff authored by native-api's avatar native-api Committed by Serhiy Storchaka

[2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) (GH-7279)

parent 46aa472a
...@@ -657,8 +657,12 @@ if have_unicode: ...@@ -657,8 +657,12 @@ if have_unicode:
unichr(0x20AC), unichr(0x20AC),
): ):
try: try:
character.encode(sys.getfilesystemencoding())\ # In Windows, 'mbcs' is used, and encode() returns '?'
.decode(sys.getfilesystemencoding()) # for characters missing in the ANSI codepage
if character.encode(sys.getfilesystemencoding())\
.decode(sys.getfilesystemencoding())\
!= character:
raise UnicodeError
except UnicodeError: except UnicodeError:
pass pass
else: else:
......
...@@ -496,12 +496,10 @@ class PosixPathTest(unittest.TestCase): ...@@ -496,12 +496,10 @@ class PosixPathTest(unittest.TestCase):
finally: finally:
os.getcwd = real_getcwd 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): def test_expandvars_nonascii_word(self):
encoding = sys.getfilesystemencoding() encoding = sys.getfilesystemencoding()
# Non-ASCII word characters uwnonascii = test_support.FS_NONASCII
letters = test_support.u(r'\xe6\u0130\u0141\u03c6\u041a\u05d0\u062a\u0e01')
uwnonascii = letters.encode(encoding, 'ignore').decode(encoding)[:3]
swnonascii = uwnonascii.encode(encoding) swnonascii = uwnonascii.encode(encoding)
if not swnonascii: if not swnonascii:
self.skipTest('Needs non-ASCII word characters') self.skipTest('Needs non-ASCII word characters')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment