summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-25 17:42:27 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-25 17:42:27 -0400
commite23f267505a42513d3ff6b636dda7425ec9052f8 (patch)
tree311755c9a5b3e5ee0b59bf8cbda888c48786d255 /tests/helpers.py
parentc926756c1794f7950bdf5ce8d9d4e4044472bb3f (diff)
parentc370442bea855f0f87217db190760629fe559150 (diff)
downloadpython-coveragepy-e23f267505a42513d3ff6b636dda7425ec9052f8.tar.gz
Merged
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 aa094bc..2723ea5 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -4,6 +4,7 @@
"""Helpers for coverage.py tests."""
import subprocess
+import sys
def run_command(cmd):
@@ -12,8 +13,12 @@ def run_command(cmd):
Returns the exit status code and the combined stdout and stderr.
"""
+ # 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.
proc = subprocess.Popen(
- cmd, shell=True,
+ "PYTHONIOENCODING=%s %s" % (sys.__stdout__.encoding, cmd),
+ shell=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)