summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-11-01 05:12:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-11-01 05:12:56 -0500
commita0a3f6b8eb562a297fd04fcdc7712745fd031045 (patch)
tree5e0fbfc7d77eaea22577dd2c1aa8765b31bed53c
parent97f4018b16d94b8dfc95e61bbf047cc7fb93289e (diff)
downloadpython-coveragepy-a0a3f6b8eb562a297fd04fcdc7712745fd031045.tar.gz
Window encodings?
-rw-r--r--tests/helpers.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index be2484f..f4bff2b 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -8,6 +8,7 @@ import subprocess
import sys
from coverage import env
+from coverage.misc import output_encoding
def run_command(cmd):
@@ -23,7 +24,7 @@ def run_command(cmd):
# the subprocess is set incorrectly to ascii. Use an environment variable
# to force the encoding to be the same as ours.
sub_env = dict(os.environ)
- encoding = sys.__stdout__.encoding
+ encoding = output_encoding()
if encoding:
sub_env['PYTHONIOENCODING'] = encoding
@@ -39,7 +40,7 @@ def run_command(cmd):
# Get the output, and canonicalize it to strings with newlines.
if not isinstance(output, str):
- output = output.decode('utf-8')
+ output = output.decode(output_encoding())
output = output.replace('\r', '')
return status, output