If there are warnings, make the status bar yellow

Also if we see any statuses the code doesn't know about.
This commit is contained in:
Eric Siegerman 2015-06-30 19:20:25 -04:00
parent cb21d844d9
commit 044d874c5b
2 changed files with 8 additions and 4 deletions

View File

@ -528,10 +528,12 @@ def flatten(l):
def build_summary_stats_line(stats): def build_summary_stats_line(stats):
keys = ("failed passed skipped deselected " keys = ("failed passed skipped deselected "
"xfailed xpassed warnings error").split() "xfailed xpassed warnings error").split()
unknown_key_seen = False
for key in stats.keys(): for key in stats.keys():
if key not in keys: if key not in keys:
if key: # setup/teardown reports have an empty key, ignore them if key: # setup/teardown reports have an empty key, ignore them
keys.append(key) keys.append(key)
unknown_key_seen = True
parts = [] parts = []
for key in keys: for key in keys:
val = stats.get(key, None) val = stats.get(key, None)
@ -541,6 +543,8 @@ def build_summary_stats_line(stats):
if 'failed' in stats or 'error' in stats: if 'failed' in stats or 'error' in stats:
color = 'red' color = 'red'
elif 'warnings' in stats or unknown_key_seen:
color = 'yellow'
else: else:
color = 'green' color = 'green'

View File

@ -732,11 +732,11 @@ def test_terminal_summary(testdir):
("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}), ("red", "1 passed, 1 error", {"error": (1,), "passed": (1,)}),
# (a status that's not known to the code) # (a status that's not known to the code)
("green", "1 weird", {"weird": (1,)}), ("yellow", "1 weird", {"weird": (1,)}),
("green", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}), ("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
("green", "1 warnings", {"warnings": (1,)}), ("yellow", "1 warnings", {"warnings": (1,)}),
("green", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}), ("yellow", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}),
("green", "5 passed", {"passed": (1,2,3,4,5)}), ("green", "5 passed", {"passed": (1,2,3,4,5)}),