Skip to content

Commit 6ce7337

Browse files
author
MarcoFalke
committed
Merge #10222: [tests] test_runner - check unicode
a97ed80 [tests] test_runner - check unicode (John Newbery) Tree-SHA512: f395297b854a967ad81eed9b822a8f33660fa2ffb9b3bd8fb3b287c32caf5792bd53faad836602f45a5e302800e04d2723d5107531f3643fbf1895e35f98d2ba
2 parents 2584925 + a97ed80 commit 6ce7337

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/functional/test_runner.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,17 @@
2727

2828
# Formatting. Default colors to empty strings.
2929
BOLD, BLUE, RED, GREY = ("", ""), ("", ""), ("", ""), ("", "")
30-
TICK = "✓ "
31-
CROSS = "✖ "
32-
CIRCLE = "○ "
30+
try:
31+
# Make sure python thinks it can write unicode to its stdout
32+
"\u2713".encode("utf_8").decode(sys.stdout.encoding)
33+
TICK = "✓ "
34+
CROSS = "✖ "
35+
CIRCLE = "○ "
36+
except UnicodeDecodeError:
37+
TICK = "P "
38+
CROSS = "x "
39+
CIRCLE = "o "
40+
3341
if os.name == 'posix':
3442
# primitive formatting on supported
3543
# terminal via ANSI escape sequences:

0 commit comments

Comments
 (0)