Commit 4991b883 authored by Victor Stinner's avatar Victor Stinner

Fix test_sys: set LC_ALL instead of LANG

LC_ALL is read before LANG to choose the locale encoding (LC_ALL, LANG and then
LC_CTYPE: use the first non empty variable).
parent 94d9b179
...@@ -507,7 +507,8 @@ class SysModuleTest(unittest.TestCase): ...@@ -507,7 +507,8 @@ class SysModuleTest(unittest.TestCase):
undecodable = b"\xff" undecodable = b"\xff"
env = os.environ.copy() env = os.environ.copy()
env['LANG'] = 'C' # Use C locale to get ascii for the locale encoding
env['LC_ALL'] = 'C'
code = ( code = (
b'import locale; ' b'import locale; '
b'print(ascii("' + undecodable + b'"), ' b'print(ascii("' + undecodable + b'"), '
...@@ -614,9 +615,9 @@ class SysModuleTest(unittest.TestCase): ...@@ -614,9 +615,9 @@ class SysModuleTest(unittest.TestCase):
# Raise SkipTest() if sys.executable is not encodable to ascii # Raise SkipTest() if sys.executable is not encodable to ascii
test.support.workaroundIssue8611() test.support.workaroundIssue8611()
# Even in C locale # Use C locale to get ascii for the locale encoding
env = os.environ.copy() env = os.environ.copy()
env['LANG'] = 'C' env['LC_ALL'] = 'C'
try: try:
del env['PYTHONFSENCODING'] del env['PYTHONFSENCODING']
except KeyError: except KeyError:
......
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