summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-20 11:17:39 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-20 11:17:39 (GMT)
commit4a5dd5c576790256b1de25e8896c332a5e125637 (patch)
treea847af14a57fa54bd0ecaec047b0d1f243b2e963 /Lib/test/test_subprocess.py
parent657977ef778c8fc080ce553fcbc3cc603518a111 (diff)
downloadcpython-4a5dd5c576790256b1de25e8896c332a5e125637.zip
cpython-4a5dd5c576790256b1de25e8896c332a5e125637.tar.gz
cpython-4a5dd5c576790256b1de25e8896c332a5e125637.tar.bz2
Merged revisions 84909-84913 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84909 | antoine.pitrou | 2010-09-20 00:46:05 +0200 (lun., 20 sept. 2010) | 3 lines Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot ........ r84910 | antoine.pitrou | 2010-09-20 01:06:53 +0200 (lun., 20 sept. 2010) | 3 lines Try to make signal-sending tests in test_subprocess more robust on slow machines ........ r84911 | antoine.pitrou | 2010-09-20 01:28:30 +0200 (lun., 20 sept. 2010) | 3 lines Make error more explicit in test_finalize_with_trace ........ r84912 | antoine.pitrou | 2010-09-20 02:12:19 +0200 (lun., 20 sept. 2010) | 3 lines Try to fix buildbot failure (#9902) ........ r84913 | antoine.pitrou | 2010-09-20 03:33:21 +0200 (lun., 20 sept. 2010) | 3 lines Try a more robust implementation of _kill_process ........
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 552b9f2..f2dbdc2 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -765,12 +765,16 @@ class ProcessTestCase(BaseTestCase):
def test_undecodable_env(self):
for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):
- value_repr = repr(value).encode("ascii")
+ value_repr = ascii(value).encode("ascii")
# 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[key] = value
+ # Force surrogate-escaping of \xFF in the child process;
+ # otherwise it can be decoded as-is if the default locale
+ # is latin-1.
+ env['PYTHONFSENCODING'] = 'ascii'
stdout = subprocess.check_output(
[sys.executable, "-c", script],
env=env)
@@ -780,7 +784,7 @@ class ProcessTestCase(BaseTestCase):
# test bytes
key = key.encode("ascii", "surrogateescape")
value = value.encode("ascii", "surrogateescape")
- 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[key] = value
stdout = subprocess.check_output(