Commit 2e8624c2 authored by Mark Hammond's avatar Mark Hammond

Fix test_unicode_file errors on platforms without Unicode file support,

by setting TESTFN_UNICODE_UNENCODEABLE on these platforms.
test_unicode_file only attempts to use the name for testing if not None.
parent 07f1dfa9
...@@ -136,6 +136,12 @@ else: ...@@ -136,6 +136,12 @@ else:
TESTFN_ENCODING=sys.getfilesystemencoding() TESTFN_ENCODING=sys.getfilesystemencoding()
# TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be
# able to be encoded by *either* the default or filesystem encoding. # able to be encoded by *either* the default or filesystem encoding.
# This test really only makes sense on Windows NT platforms
# which have special Unicode support in posixmodule.
if not hasattr(sys, "getwindowsversion") or \
sys.getwindowsversion()[3]<2:
TESTFN_UNICODE_UNENCODABLE = None
else:
# Japanese characters (I think - from bug 846133) # Japanese characters (I think - from bug 846133)
TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b" TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b"
try: try:
......
...@@ -140,6 +140,7 @@ class TestUnicodeFiles(unittest.TestCase): ...@@ -140,6 +140,7 @@ class TestUnicodeFiles(unittest.TestCase):
def test_single_files(self): def test_single_files(self):
self._test_single(TESTFN_ENCODED) self._test_single(TESTFN_ENCODED)
self._test_single(TESTFN_UNICODE) self._test_single(TESTFN_UNICODE)
if TESTFN_UNICODE_UNENCODEABLE is not None:
self._test_single(TESTFN_UNICODE_UNENCODEABLE) self._test_single(TESTFN_UNICODE_UNENCODEABLE)
def test_equivalent_files(self): def test_equivalent_files(self):
...@@ -156,6 +157,7 @@ class TestUnicodeFiles(unittest.TestCase): ...@@ -156,6 +157,7 @@ class TestUnicodeFiles(unittest.TestCase):
self._do_directory(TESTFN_UNICODE+ext, TESTFN_ENCODED+ext, os.getcwdu) self._do_directory(TESTFN_UNICODE+ext, TESTFN_ENCODED+ext, os.getcwdu)
self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, os.getcwdu) self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, os.getcwdu)
# Our directory name that can't use a non-unicode name. # Our directory name that can't use a non-unicode name.
if TESTFN_UNICODE_UNENCODEABLE is not None:
self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext,
TESTFN_UNICODE_UNENCODEABLE+ext, TESTFN_UNICODE_UNENCODEABLE+ext,
os.getcwdu) os.getcwdu)
......
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