Try to fix failures on platforms that can't encode the test characters.
authorBrian Curtin <brian.curtin@gmail.com>
Tue, 30 Nov 2010 15:40:04 +0000 (15:40 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Tue, 30 Nov 2010 15:40:04 +0000 (15:40 +0000)
Skip the test if encoding fails.

Lib/test/test_os.py

index 5a37522ad82e3a03464d2a0bbdd5551399a3ef02..d58097dc5c32a406e10463e0cc3b04bcfbc6d4dc 100644 (file)
@@ -888,7 +888,12 @@ class LinkTests(unittest.TestCase):
                         bytes(self.file2, sys.getfilesystemencoding()))
 
     def test_mbcs_name(self):
-        self.file1 += "\u65e5\u672c"
+        try:
+            chars = os.fsencode("\u65e5\u672c")
+        except UnicodeError:
+            raise unittest.SkipTest("Unable to encode for this platform.")
+
+        self.file1 += chars
         self.file2 = self.file1 + "2"
         self._test_link(self.file1, self.file2)