@ -28,7 +28,7 @@ import logging
import unittest
import unittest
# Formatting. Default colors to empty strings.
# Formatting. Default colors to empty strings.
BOLD , GREEN , RED , GREY = ( " " , " " ) , ( " " , " " ) , ( " " , " " ) , ( " " , " " )
DEFAULT , BOLD , GREEN , RED = ( " " , " " ) , ( " " , " " ) , ( " " , " " ) , ( " " , " " )
try :
try :
# Make sure python thinks it can write unicode to its stdout
# Make sure python thinks it can write unicode to its stdout
" \u2713 " . encode ( " utf_8 " ) . decode ( sys . stdout . encoding )
" \u2713 " . encode ( " utf_8 " ) . decode ( sys . stdout . encoding )
@ -59,10 +59,10 @@ if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393): #type:ignore
kernel32 . SetConsoleMode ( stderr , stderr_mode . value | ENABLE_VIRTUAL_TERMINAL_PROCESSING )
kernel32 . SetConsoleMode ( stderr , stderr_mode . value | ENABLE_VIRTUAL_TERMINAL_PROCESSING )
# primitive formatting on supported
# primitive formatting on supported
# terminal via ANSI escape sequences:
# terminal via ANSI escape sequences:
DEFAULT = ( ' \033 [0m ' , ' \033 [0m ' )
BOLD = ( ' \033 [0m ' , ' \033 [1m ' )
BOLD = ( ' \033 [0m ' , ' \033 [1m ' )
GREEN = ( ' \033 [0m ' , ' \033 [0;32m ' )
GREEN = ( ' \033 [0m ' , ' \033 [0;32m ' )
RED = ( ' \033 [0m ' , ' \033 [0;31m ' )
RED = ( ' \033 [0m ' , ' \033 [0;31m ' )
GREY = ( ' \033 [0m ' , ' \033 [1;30m ' )
TEST_EXIT_PASSED = 0
TEST_EXIT_PASSED = 0
TEST_EXIT_SKIPPED = 77
TEST_EXIT_SKIPPED = 77
@ -366,11 +366,11 @@ def main():
args , unknown_args = parser . parse_known_args ( )
args , unknown_args = parser . parse_known_args ( )
if not args . ansi :
if not args . ansi :
global BOLD , GREEN , RED , GREY
global DEFAULT , BOLD , GREEN , RED
DEFAULT = ( " " , " " )
BOLD = ( " " , " " )
BOLD = ( " " , " " )
GREEN = ( " " , " " )
GREEN = ( " " , " " )
RED = ( " " , " " )
RED = ( " " , " " )
GREY = ( " " , " " )
# args to be passed on always start with two dashes; tests are the remaining unknown args
# args to be passed on always start with two dashes; tests are the remaining unknown args
tests = [ arg for arg in unknown_args if arg [ : 2 ] != " -- " ]
tests = [ arg for arg in unknown_args if arg [ : 2 ] != " -- " ]
@ -714,7 +714,7 @@ class TestResult():
color = RED
color = RED
glyph = CROSS
glyph = CROSS
elif self . status == " Skipped " :
elif self . status == " Skipped " :
color = GREY
color = DEFAULT
glyph = CIRCLE
glyph = CIRCLE
return color [ 1 ] + " %s | %s %s | %s s \n " % ( self . name . ljust ( self . padding ) , glyph , self . status . ljust ( 7 ) , self . time ) + color [ 0 ]
return color [ 1 ] + " %s | %s %s | %s s \n " % ( self . name . ljust ( self . padding ) , glyph , self . status . ljust ( 7 ) , self . time ) + color [ 0 ]