diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-31 11:11:05 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-31 11:11:05 -0400 |
commit | 2cd23e5f721fa693c4f5643062b074681cc4df9a (patch) | |
tree | c0a7cf74f07ae9de037bb9a2fc3894a14a2ebd15 /tests/helpers.py | |
parent | cfee1508fc3e58e8d4cfb0f3f5c2848090f8713c (diff) | |
parent | 7c178919e8a8ef9104bf415c5529c63db707abb6 (diff) | |
download | python-coveragepy-2cd23e5f721fa693c4f5643062b074681cc4df9a.tar.gz |
Merge
Diffstat (limited to 'tests/helpers.py')
-rw-r--r-- | tests/helpers.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/helpers.py b/tests/helpers.py index d652fe8..be2484f 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 ) |