Skip to content

Commit 0d8fc8d

Browse files
committed
Merge #12811: test: Make summary row bold-red if any test failed and show failed tests at end of table
ffb033a test: List any failed tests at the end of test_runner output (Anthony Towns) f92541f test: Make summary row bold-red if any test failed (Wladimir J. van der Laan) Pull request description: Make the summary row of the test runner bold red if *any* test fails. This helps visibility if something fails. (yesteryday I had a snafu where I missed that `feature_blocksdir.py` had failed because it's one of the earlier tests in the list, this intends to avoid that in the future) Before: ![testfailold](https://user-images.githubusercontent.com/126646/38021100-3fbaf1c6-327c-11e8-8bae-d3ba46e77408.png) After: ![testfailnew](https://user-images.githubusercontent.com/126646/38021108-43ac7ef8-327c-11e8-8566-e52bcbaf89b8.png) If tests pass it still looks the same: ![testok](https://user-images.githubusercontent.com/126646/38021115-4a8e9954-327c-11e8-8fe4-34e889384d3e.png) Tree-SHA512: 057748c693ca1c80840e4e4cdea8aa1baf8996f03d6805975d8e3c07c4ba0087cd8fa83f891d6bf1af0bfbba88b5d46bd5d852df340d755202bd32ae6f1034b5
2 parents 174d016 + ffb033a commit 0d8fc8d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/functional/test_runner.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_cove
367367
def print_results(test_results, max_len_name, runtime):
368368
results = "\n" + BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0]
369369

370-
test_results.sort(key=lambda result: result.name.lower())
370+
test_results.sort(key=TestResult.sort_key)
371371
all_passed = True
372372
time_sum = 0
373373

@@ -378,7 +378,11 @@ def print_results(test_results, max_len_name, runtime):
378378
results += str(test_result)
379379

380380
status = TICK + "Passed" if all_passed else CROSS + "Failed"
381+
if not all_passed:
382+
results += RED[1]
381383
results += BOLD[1] + "\n%s | %s | %s s (accumulated) \n" % ("ALL".ljust(max_len_name), status.ljust(9), time_sum) + BOLD[0]
384+
if not all_passed:
385+
results += RED[0]
382386
results += "Runtime: %s s\n" % (runtime)
383387
print(results)
384388

@@ -455,6 +459,14 @@ def __init__(self, name, status, time):
455459
self.time = time
456460
self.padding = 0
457461

462+
def sort_key(self):
463+
if self.status == "Passed":
464+
return 0, self.name.lower()
465+
elif self.status == "Failed":
466+
return 2, self.name.lower()
467+
elif self.status == "Skipped":
468+
return 1, self.name.lower()
469+
458470
def __repr__(self):
459471
if self.status == "Passed":
460472
color = BLUE

0 commit comments

Comments
 (0)