summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-31 11:10:29 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-31 11:10:29 -0400
commitf66e3cc366e0a50041bf782cf66c4096b39dbdd0 (patch)
tree3397e97d2fa3c958ef267052e33ecb1e648ac78b /tests/helpers.py
parent207a3c22bdc6ab06946284b8916b6bd0b3ff256d (diff)
downloadpython-coveragepy-git-f66e3cc366e0a50041bf782cf66c4096b39dbdd0.tar.gz
Fix the non-ascii filename tests on windows (?)
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py5
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.