Parse pytest color output correctly.
This commit is contained in:
parent
b5f712165b
commit
ad6a093b92
1 changed files with 5 additions and 5 deletions
|
|
@ -162,7 +162,7 @@ class TermStr(collections.UserString):
|
|||
codes = part[1:end_index].split(";")
|
||||
previous_code = None
|
||||
for index, code in enumerate(codes):
|
||||
if code in ["", "0"]: # Normal
|
||||
if code in ["", "0", "00"]: # Normal
|
||||
is_bold, is_italic, is_underlined = False, False, False
|
||||
fg_color, bg_color = None, None
|
||||
elif code in ["01", "1"]: # bold
|
||||
|
|
@ -171,13 +171,13 @@ class TermStr(collections.UserString):
|
|||
is_italic = True
|
||||
elif code in ["04", "4"]: # underline
|
||||
is_underlined = True
|
||||
elif len(code) == 2 and code.startswith("3"): # dim fg color
|
||||
elif 30 <= int(code) <= 37 : # dim fg color
|
||||
fg_color = int(code[1])
|
||||
elif len(code) == 2 and code.startswith("4"): # dim bg color
|
||||
elif 40 <= int(code) <= 47: # dim bg color
|
||||
bg_color = int(code[1])
|
||||
elif len(code) == 2 and code.startswith("9"): # high fg color
|
||||
elif 90 <= int(code) <= 97: # high fg color
|
||||
fg_color = int(code[1]) + 8
|
||||
elif len(code) == 3 and code.startswith("10"): # high bg color
|
||||
elif 100 <= int(code) <= 107: # high bg color
|
||||
bg_color = int(code[2]) + 8
|
||||
elif code == "5" and previous_code == "38": # simple fg color
|
||||
fg_color = int(codes[index+1])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue