summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-25 18:27:24 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-25 18:27:24 -0400
commit57bd9f25449c2368e668087c6df999593ee42580 (patch)
tree26e22d25d5310045cf6e92d020a80f411039e8f1 /tests/helpers.py
parentaf84377e61971aa8ae279b4611ae23dfc6567da8 (diff)
downloadpython-coveragepy-57bd9f25449c2368e668087c6df999593ee42580.tar.gz
Set the PYTHONIOENCODING environment variable in an OS-neutral way.
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index 2723ea5..f0859f5 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -3,6 +3,7 @@
"""Helpers for coverage.py tests."""
+import os
import subprocess
import sys
@@ -17,8 +18,9 @@ def run_command(cmd):
# the subprocess is set incorrectly to ascii. Use an environment variable
# to force the encoding to be the same as ours.
proc = subprocess.Popen(
- "PYTHONIOENCODING=%s %s" % (sys.__stdout__.encoding, cmd),
+ cmd,
shell=True,
+ env=dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding),
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)