From 6f611b791c088656f6274cbfe683efb2df45a485 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 4 Jul 2015 15:18:11 -0700 Subject: spec_tests.py: force utf-8 on test failure output. See #345. --- test/spec_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/spec_tests.py b/test/spec_tests.py index 392049d..11b271c 100755 --- a/test/spec_tests.py +++ b/test/spec_tests.py @@ -52,7 +52,7 @@ def do_test(test, normalize, result_counts): result_counts['pass'] += 1 else: print_test_header(test['section'], test['example'], test['start_line'], test['end_line']) - sys.stdout.write(test['markdown']) + sys.stdout.buffer.write(test['markdown'].encode('utf-8')) if unicode_error: print("Unicode error: " + str(unicode_error)) print("Expected: " + repr(expected_html)) @@ -62,7 +62,7 @@ def do_test(test, normalize, result_counts): actual_html_lines = actual_html.splitlines(True) for diffline in unified_diff(expected_html_lines, actual_html_lines, "expected HTML", "actual HTML"): - sys.stdout.write(diffline) + sys.stdout.buffer.write(diffline.encode('utf-8')) sys.stdout.write('\n') result_counts['fail'] += 1 else: -- cgit v1.2.3