diff options
-rw-r--r-- | tests/helpers.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/helpers.py b/tests/helpers.py index be2484f3..f4bff2b0 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 |