From ba5c1bfbc755814a0c19af4ee3be2d362e81c3db Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2015 19:28:29 -0400 Subject: Diagnostic for appveyor --- tests/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/helpers.py') diff --git a/tests/helpers.py b/tests/helpers.py index f0859f5..e85c784 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -17,10 +17,12 @@ def run_command(cmd): # 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. + sub_env = dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding) + print("SUB_ENV: %r" % (sub_env,)) proc = subprocess.Popen( cmd, shell=True, - env=dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding), + env=sub_env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) -- cgit v1.2.1 From d2f814d4e90601ee40d6528281f74d9037002f42 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2015 19:41:34 -0400 Subject: Diagnostic for appveyor, part 2 of N --- tests/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/helpers.py') diff --git a/tests/helpers.py b/tests/helpers.py index e85c784..67d51b2 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -18,7 +18,8 @@ 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, PYTHONIOENCODING=sys.__stdout__.encoding) - print("SUB_ENV: %r" % (sub_env,)) + print("__stdout__: %r, enc = %r" % (sys.__stdout__, sys.__stdout__.encoding)) + print("stdout: %r, enc = %r" % (sys.stdout, sys.stdout.encoding)) proc = subprocess.Popen( cmd, shell=True, -- cgit v1.2.1 From 7c178919e8a8ef9104bf415c5529c63db707abb6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2015 19:51:41 -0400 Subject: Account for no encoding at all... --- tests/helpers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/helpers.py') diff --git a/tests/helpers.py b/tests/helpers.py index 67d51b2..fa94b10 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -17,9 +17,11 @@ def run_command(cmd): # 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. - sub_env = dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding) - print("__stdout__: %r, enc = %r" % (sys.__stdout__, sys.__stdout__.encoding)) - print("stdout: %r, enc = %r" % (sys.stdout, sys.stdout.encoding)) + sub_env = dict(os.environ) + encoding = sys.__stdout__.encoding + if encoding: + sub_env['PYTHONIOENCODING'] = encoding + proc = subprocess.Popen( cmd, shell=True, -- cgit v1.2.1