summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-25 19:51:41 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-25 19:51:41 -0400
commit22872dc68e7bda9d3ce6bb7b6c499ec6ec0c395e (patch)
tree739a17ecc7107022e3502a9bfc6768ca02756efd /tests/helpers.py
parent0d1c4843236b6763cb096645d3fc040995e71637 (diff)
downloadpython-coveragepy-git-22872dc68e7bda9d3ce6bb7b6c499ec6ec0c395e.tar.gz
Account for no encoding at all...
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 67d51b25..fa94b108 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -17,9 +17,11 @@ 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, PYTHONIOENCODING=sys.__stdout__.encoding)
- print("__stdout__: %r, enc = %r" % (sys.__stdout__, sys.__stdout__.encoding))
- print("stdout: %r, enc = %r" % (sys.stdout, sys.stdout.encoding))
+ sub_env = dict(os.environ)
+ encoding = sys.__stdout__.encoding
+ if encoding:
+ sub_env['PYTHONIOENCODING'] = encoding
+
proc = subprocess.Popen(
cmd,
shell=True,