test_subprocess doesn't need to C locale to test os.environb

Improve also the comment to explain why C locale is needed to test os.environ.
This commit is contained in:
Victor Stinner 2010-10-14 10:43:31 +00:00
parent ebc78d23ef
commit 89f3ad10d2
1 changed files with 3 additions and 3 deletions

View File

@ -885,7 +885,9 @@ class POSIXProcessTestCase(BaseTestCase):
script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
env = os.environ.copy()
env[key] = value
# Use C locale to get ascii for the locale encoding
# Use C locale to get ascii for the locale encoding to force
# surrogate-escaping of \xFF in the child process; otherwise it can
# be decoded as-is if the default locale is latin-1.
env['LC_ALL'] = 'C'
stdout = subprocess.check_output(
[sys.executable, "-c", script],
@ -899,8 +901,6 @@ class POSIXProcessTestCase(BaseTestCase):
script = "import os; print(ascii(os.getenvb(%s)))" % repr(key)
env = os.environ.copy()
env[key] = value
# Use C locale to get ascii for the locale encoding
env['LC_ALL'] = 'C'
stdout = subprocess.check_output(
[sys.executable, "-c", script],
env=env)