]> granicus.if.org Git - python/commitdiff
Fix test_sys: set LC_ALL instead of LANG
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 25 Aug 2010 08:33:34 +0000 (08:33 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 25 Aug 2010 08:33:34 +0000 (08:33 +0000)
LC_ALL is read before LANG to choose the locale encoding (LC_ALL, LANG and then
LC_CTYPE: use the first non empty variable).

Lib/test/test_sys.py

index ee8df4d6802def7e3803d1b72840890dff75d82a..8cfbaafd4e0bf5dcd9a7fca674c226192a87219f 100644 (file)
@@ -507,7 +507,8 @@ class SysModuleTest(unittest.TestCase):
 
         undecodable = b"\xff"
         env = os.environ.copy()
-        env['LANG'] = 'C'
+        # Use C locale to get ascii for the locale encoding
+        env['LC_ALL'] = 'C'
         code = (
             b'import locale; '
             b'print(ascii("' + undecodable + b'"), '
@@ -614,9 +615,9 @@ class SysModuleTest(unittest.TestCase):
         # Raise SkipTest() if sys.executable is not encodable to ascii
         test.support.workaroundIssue8611()
 
-        # Even in C locale
+        # Use C locale to get ascii for the locale encoding
         env = os.environ.copy()
-        env['LANG'] = 'C'
+        env['LC_ALL'] = 'C'
         try:
             del env['PYTHONFSENCODING']
         except KeyError: