aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-04 15:18:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-04 15:18:29 -0700
commit6f611b791c088656f6274cbfe683efb2df45a485 (patch)
tree8ea4521620ff4c137612de661983d58f67c33c8f
parent73792117e87482077a95c472b254c8b51719bcfd (diff)
spec_tests.py: force utf-8 on test failure output.
See #345.
-rwxr-xr-xtest/spec_tests.py4
1 files changed, 2 insertions, 2 deletions
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: