]> granicus.if.org Git - python/commitdiff
Fix test_os: workaround #8611 bug
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 19 Aug 2010 11:17:12 +0000 (11:17 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 19 Aug 2010 11:17:12 +0000 (11:17 +0000)
Lib/test/test_os.py

index cd8a1b973eef1d124d3baf79809598447d3cd41c..4910b1e3a9885ea20f2325b6fc83b413a072a068 100644 (file)
@@ -1165,9 +1165,16 @@ class FSEncodingTests(unittest.TestCase):
             decoded = self.get_output(encoding, 'repr(os.fsdecode(%a))' % bytesfn)
             self.assertEqual(decoded, repr(unicodefn))
 
-        check('ascii', b'abc\xff', 'abc\udcff')
         check('utf-8', b'\xc3\xa9\x80', '\xe9\udc80')
-        check('iso-8859-15', b'\xef\xa4', '\xef\u20ac')
+        try:
+            sys.executable.encode("ascii")
+        except UnicodeEncodeError:
+            # Python doesn't start with ASCII locale if its path is not ASCII,
+            # see issue #8611
+            pass
+        else:
+            check('ascii', b'abc\xff', 'abc\udcff')
+            check('iso-8859-15', b'\xef\xa4', '\xef\u20ac')
 
 
 def test_main():