mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot
This commit is contained in:
parent
bc2eff3112
commit
fb8db8f635
1 changed files with 4 additions and 4 deletions
|
@ -886,26 +886,26 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
def test_undecodable_env(self):
|
def test_undecodable_env(self):
|
||||||
for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
|
for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
|
||||||
# test str with surrogates
|
# test str with surrogates
|
||||||
script = "import os; print(repr(os.getenv(%s)))" % repr(key)
|
script = "import os; print(ascii(os.getenv(%s)))" % repr(key)
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env[key] = value
|
env[key] = value
|
||||||
stdout = subprocess.check_output(
|
stdout = subprocess.check_output(
|
||||||
[sys.executable, "-c", script],
|
[sys.executable, "-c", script],
|
||||||
env=env)
|
env=env)
|
||||||
stdout = stdout.rstrip(b'\n\r')
|
stdout = stdout.rstrip(b'\n\r')
|
||||||
self.assertEquals(stdout.decode('ascii'), repr(value))
|
self.assertEquals(stdout.decode('ascii'), ascii(value))
|
||||||
|
|
||||||
# test bytes
|
# test bytes
|
||||||
key = key.encode("ascii", "surrogateescape")
|
key = key.encode("ascii", "surrogateescape")
|
||||||
value = value.encode("ascii", "surrogateescape")
|
value = value.encode("ascii", "surrogateescape")
|
||||||
script = "import os; print(repr(os.getenvb(%s)))" % repr(key)
|
script = "import os; print(ascii(os.getenvb(%s)))" % repr(key)
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env[key] = value
|
env[key] = value
|
||||||
stdout = subprocess.check_output(
|
stdout = subprocess.check_output(
|
||||||
[sys.executable, "-c", script],
|
[sys.executable, "-c", script],
|
||||||
env=env)
|
env=env)
|
||||||
stdout = stdout.rstrip(b'\n\r')
|
stdout = stdout.rstrip(b'\n\r')
|
||||||
self.assertEquals(stdout.decode('ascii'), repr(value))
|
self.assertEquals(stdout.decode('ascii'), ascii(value))
|
||||||
|
|
||||||
def test_bytes_program(self):
|
def test_bytes_program(self):
|
||||||
abs_program = os.fsencode(sys.executable)
|
abs_program = os.fsencode(sys.executable)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue