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
commitcfee1508fc3e58e8d4cfb0f3f5c2848090f8713c (patch)
tree535752b7d29bbb0adf006def6a4dd5f9d01d6eaf /tests/helpers.py
parent57bd9f25449c2368e668087c6df999593ee42580 (diff)
downloadpython-coveragepy-cfee1508fc3e58e8d4cfb0f3f5c2848090f8713c.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 f0859f5..d652fe8 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.