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
This commit is contained in:
commit
0d8fc8de07
1 changed files with 13 additions and 1 deletions
|
@ -367,7 +367,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_cove
|
|||
def print_results(test_results, max_len_name, runtime):
|
||||
results = "\n" + BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0]
|
||||
|
||||
test_results.sort(key=lambda result: result.name.lower())
|
||||
test_results.sort(key=TestResult.sort_key)
|
||||
all_passed = True
|
||||
time_sum = 0
|
||||
|
||||
|
@ -378,7 +378,11 @@ def print_results(test_results, max_len_name, runtime):
|
|||
results += str(test_result)
|
||||
|
||||
status = TICK + "Passed" if all_passed else CROSS + "Failed"
|
||||
if not all_passed:
|
||||
results += RED[1]
|
||||
results += BOLD[1] + "\n%s | %s | %s s (accumulated) \n" % ("ALL".ljust(max_len_name), status.ljust(9), time_sum) + BOLD[0]
|
||||
if not all_passed:
|
||||
results += RED[0]
|
||||
results += "Runtime: %s s\n" % (runtime)
|
||||
print(results)
|
||||
|
||||
|
@ -455,6 +459,14 @@ class TestResult():
|
|||
self.time = time
|
||||
self.padding = 0
|
||||
|
||||
def sort_key(self):
|
||||
if self.status == "Passed":
|
||||
return 0, self.name.lower()
|
||||
elif self.status == "Failed":
|
||||
return 2, self.name.lower()
|
||||
elif self.status == "Skipped":
|
||||
return 1, self.name.lower()
|
||||
|
||||
def __repr__(self):
|
||||
if self.status == "Passed":
|
||||
color = BLUE
|
||||
|
|
Loading…
Reference in a new issue