diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-31 11:10:29 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-31 11:10:29 -0400 |
commit | f66e3cc366e0a50041bf782cf66c4096b39dbdd0 (patch) | |
tree | 3397e97d2fa3c958ef267052e33ecb1e648ac78b /tests/helpers.py | |
parent | 207a3c22bdc6ab06946284b8916b6bd0b3ff256d (diff) | |
download | python-coveragepy-git-f66e3cc366e0a50041bf782cf66c4096b39dbdd0.tar.gz |
Fix the non-ascii filename tests on windows (?)
Diffstat (limited to 'tests/helpers.py')
-rw-r--r-- | tests/helpers.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py index f0859f51..d652fe8e 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -7,6 +7,8 @@ import os import subprocess import sys +from coverage import env + def run_command(cmd): """Run a command in a sub-process. @@ -14,6 +16,9 @@ def run_command(cmd): Returns the exit status code and the combined stdout and stderr. """ + if env.PY2 and isinstance(cmd, unicode): + cmd = cmd.encode(sys.getfilesystemencoding()) + # 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. |