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 | c370442bea855f0f87217db190760629fe559150 (patch) | |
| tree | 3fc7a69e49849c5d95f5ee3c3163cdede38cec45 /tests/helpers.py | |
| parent | 2825bdb540f1b14ae9855e57ecb0b1e4d1098894 (diff) | |
| download | python-coveragepy-c370442bea855f0f87217db190760629fe559150.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 aa094bc..2723ea5 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 ) |
