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
commit207a3c22bdc6ab06946284b8916b6bd0b3ff256d (patch)
tree286a59c8780f7f6c4c77ac1de2a7f94dd83702e8 /tests/helpers.py
parent15635fdad644978f07c91183d4b37bad55f32494 (diff)
downloadpython-coveragepy-git-207a3c22bdc6ab06946284b8916b6bd0b3ff256d.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 2723ea59..f0859f51 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
)