diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-25 17:40:09 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-25 17:40:09 -0400 |
commit | b810cbc0d06df0a04e3380166215b8ad2f40524c (patch) | |
tree | b0ea1499815b84301fa7991e37de128265526e81 /tests/helpers.py | |
parent | 15100248c12b85a00278371fea60f07718a9d499 (diff) | |
download | python-coveragepy-git-b810cbc0d06df0a04e3380166215b8ad2f40524c.tar.gz |
Properly handle filenames with non-ASCII characters. #432
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 aa094bc1..2723ea59 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 ) |