test: List any failed tests at the end of test_runner output

Change sorting output to put failed tests at the end of test_runner
output.
This commit is contained in:
Anthony Towns 2018-03-28 19:55:34 +10:00 committed by Wladimir J. van der Laan
parent f92541f7ea
commit ffb033a6d5

View file

@ -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
@ -459,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