[Python-checkins] cpython: Issue #15441: Skip test_nonascii_abspath() of test_genericpath on Windows
victor.stinner
python-checkins at python.org
Wed Aug 1 20:07:53 CEST 2012
http://hg.python.org/cpython/rev/3edc71ed19e7
changeset: 78374:3edc71ed19e7
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Aug 01 20:03:49 2012 +0200
summary:
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
files:
Lib/test/test_genericpath.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -299,8 +299,7 @@
unicwd = '\xe7w\xf0'
try:
- fsencoding = support.TESTFN_ENCODING or "ascii"
- unicwd.encode(fsencoding)
+ os.fsencode(unicwd)
except (AttributeError, UnicodeEncodeError):
# FS encoding is probably ASCII
pass
@@ -312,10 +311,19 @@
@unittest.skipIf(sys.platform == 'darwin',
"Mac OS X denies the creation of a directory with an invalid utf8 name")
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.
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
- with support.temp_cwd(b'\xe7w\xf0'):
+ with support.temp_cwd(name):
self.test_abspath()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list