summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-11-10 11:07:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-11-10 11:07:39 (GMT)
commitff3d515952aa6eabdb82a90b9fe6f9dc33a406e5 (patch)
tree86bb37049fad83ab74cf568623274bdd97c115f0 /Lib/test/test_genericpath.py
parentef3971d3e57ea8364a90581abb36c746a91f8001 (diff)
downloadcpython-ff3d515952aa6eabdb82a90b9fe6f9dc33a406e5.zip
cpython-ff3d515952aa6eabdb82a90b9fe6f9dc33a406e5.tar.gz
cpython-ff3d515952aa6eabdb82a90b9fe6f9dc33a406e5.tar.bz2
Issue #16444, #16218: Use TESTFN_UNDECODABLE on UNIX
Check if data is decoded by os.fsdecode() (filesystem encoding with surrogateescape error handler, PEP 383), not by UTF-8 or the filesystem encoding in strict mode. Use TESTFN_UNDECODABLE in test_cmd_line_script.test_non_ascii() on UNIX.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 9d1d2bc..084dbb2 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -309,26 +309,17 @@ class CommonTest(GenericTest):
self.assertIsInstance(abspath(path), str)
def test_nonascii_abspath(self):
- # Test non-ASCII in the path
- if sys.platform in ('win32', 'darwin'):
- if support.TESTFN_NONASCII:
- name = support.TESTFN_NONASCII
- else:
- # Mac OS X denies the creation of a directory with an invalid
- # UTF-8 name. Windows allows to create a directory with an
- # arbitrary bytes name, but fails to enter this directory
- # (when the bytes name is used).
- self.skipTest("need support.TESTFN_NONASCII")
+ if (support.TESTFN_UNDECODABLE
+ # Mac OS X denies the creation of a directory with an invalid
+ # UTF-8 name. Windows allows to create a directory with an
+ # arbitrary bytes name, but fails to enter this directory
+ # (when the bytes name is used).
+ and sys.platform not in ('win32', 'darwin')):
+ name = support.TESTFN_UNDECODABLE
+ elif support.TESTFN_NONASCII:
+ name = support.TESTFN_NONASCII
else:
- if support.TESTFN_UNDECODABLE:
- name = support.TESTFN_UNDECODABLE
- elif support.TESTFN_NONASCII:
- name = support.TESTFN_NONASCII
- else:
- # On UNIX, the surrogateescape error handler is used to
- # decode paths, so any byte is allowed, it does not depend
- # on the locale
- name = b'a\xffb\xe7w\xf0'
+ self.skipTest("need support.TESTFN_NONASCII")
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)