Commit 7c7ea62e authored by Victor Stinner's avatar Victor Stinner

Issue #15441: Skip test_nonascii_abspath() of test_genericpath on Windows

if the bytes filenames cannot be encoded from the file system (ANSI) code page
parent 53386d8f
...@@ -299,8 +299,7 @@ class CommonTest(GenericTest): ...@@ -299,8 +299,7 @@ class CommonTest(GenericTest):
unicwd = '\xe7w\xf0' unicwd = '\xe7w\xf0'
try: try:
fsencoding = support.TESTFN_ENCODING or "ascii" os.fsencode(unicwd)
unicwd.encode(fsencoding)
except (AttributeError, UnicodeEncodeError): except (AttributeError, UnicodeEncodeError):
# FS encoding is probably ASCII # FS encoding is probably ASCII
pass pass
...@@ -312,10 +311,19 @@ class CommonTest(GenericTest): ...@@ -312,10 +311,19 @@ class CommonTest(GenericTest):
@unittest.skipIf(sys.platform == 'darwin', @unittest.skipIf(sys.platform == 'darwin',
"Mac OS X denies the creation of a directory with an invalid utf8 name") "Mac OS X denies the creation of a directory with an invalid utf8 name")
def test_nonascii_abspath(self): def test_nonascii_abspath(self):
name = b'\xe7w\xf0'
if sys.platform == 'win32':
try:
os.fsdecode(name)
except UnicodeDecodeError:
self.skipTest("the filename %a is not decodable "
"from the ANSI code page %s"
% (name, sys.getfilesystemencoding()))
# Test non-ASCII, non-UTF8 bytes in the path. # Test non-ASCII, non-UTF8 bytes in the path.
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning) warnings.simplefilter("ignore", DeprecationWarning)
with support.temp_cwd(b'\xe7w\xf0'): with support.temp_cwd(name):
self.test_abspath() self.test_abspath()
......
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