diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-27 18:29:45 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-04-27 18:29:45 (GMT) |
commit | 097d1b709a63e2a3fc1eed2170a2e9b506b20a7d (patch) | |
tree | 94cdd3a77688bf53f0e835b15d3b56f1b8ee5f46 /Lib | |
parent | 537bed68ba830651fa1e64c67d5fa991c63d88c6 (diff) | |
download | cpython-097d1b709a63e2a3fc1eed2170a2e9b506b20a7d.zip cpython-097d1b709a63e2a3fc1eed2170a2e9b506b20a7d.tar.gz cpython-097d1b709a63e2a3fc1eed2170a2e9b506b20a7d.tar.bz2 |
test_subprocess: test_undecodable_env() is specific to POSIX system
The bug was introduced by the backport of r80421 (r80494).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_subprocess.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 7711293..a4a4407 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -539,32 +539,6 @@ class ProcessTestCase(unittest.TestCase): if err.errno != 2: # ignore "no such file" raise - def test_undecodable_env(self): - for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): - value_repr = repr(value).encode("ascii") - - # test str with surrogates - script = "import os; print(repr(os.getenv(%s)))" % repr(key) - env = os.environ.copy() - env[key] = value - stdout = subprocess.check_output( - [sys.executable, "-c", script], - env=env) - stdout = stdout.rstrip(b'\n\r') - self.assertEquals(stdout, value_repr) - - # test bytes - key = key.encode("ascii", "surrogateescape") - value = value.encode("ascii", "surrogateescape") - script = "import os; print(repr(os.getenv(%s)))" % repr(key) - env = os.environ.copy() - env[key] = value - stdout = subprocess.check_output( - [sys.executable, "-c", script], - env=env) - stdout = stdout.rstrip(b'\n\r') - self.assertEquals(stdout, value_repr) - # # POSIX tests # @@ -704,6 +678,32 @@ class ProcessTestCase(unittest.TestCase): p.terminate() self.assertEqual(p.wait(), -signal.SIGTERM) + def test_undecodable_env(self): + for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): + value_repr = repr(value).encode("ascii") + + # test str with surrogates + script = "import os; print(repr(os.getenv(%s)))" % repr(key) + env = os.environ.copy() + env[key] = value + stdout = subprocess.check_output( + [sys.executable, "-c", script], + env=env) + stdout = stdout.rstrip(b'\n\r') + self.assertEquals(stdout, value_repr) + + # test bytes + key = key.encode("ascii", "surrogateescape") + value = value.encode("ascii", "surrogateescape") + script = "import os; print(repr(os.getenv(%s)))" % repr(key) + env = os.environ.copy() + env[key] = value + stdout = subprocess.check_output( + [sys.executable, "-c", script], + env=env) + stdout = stdout.rstrip(b'\n\r') + self.assertEquals(stdout, value_repr) + # # Windows tests # |