summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-31 11:11:05 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-31 11:11:05 -0400
commite6f0a4e607e1f70315957034db4ac672421ae263 (patch)
treefdab7463bec3a52ac62d26e22c98d9ec2f8436c9 /tests/helpers.py
parentf66e3cc366e0a50041bf782cf66c4096b39dbdd0 (diff)
parent22872dc68e7bda9d3ce6bb7b6c499ec6ec0c395e (diff)
downloadpython-coveragepy-git-e6f0a4e607e1f70315957034db4ac672421ae263.tar.gz
Merge
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index d652fe8e..be2484f3 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -22,10 +22,15 @@ def run_command(cmd):
# In some strange cases (PyPy3 in a virtualenv!?) the stdout encoding of
# the subprocess is set incorrectly to ascii. Use an environment variable
# to force the encoding to be the same as ours.
+ sub_env = dict(os.environ)
+ encoding = sys.__stdout__.encoding
+ if encoding:
+ sub_env['PYTHONIOENCODING'] = encoding
+
proc = subprocess.Popen(
cmd,
shell=True,
- env=dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding),
+ env=sub_env,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)