Skip to content

Commit a832cc5

Browse files
authored
More informative summary line for tests table (#4071)
Summarize tests statuses instead of incorrectly labelling as failing: Before: > 19 failing tests After: > 19 interesting tests: 10 flaky, 7 KNOWN, 1 SKIP, 1 RECOVERED
1 parent d297d57 commit a832cc5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tools/gh_parse.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,14 @@ def key(column):
518518
per_testkey_result = simplified_results.pop(test_key)
519519

520520
table = []
521+
summary = {}
521522
for test_key, items in simplified_results.items():
522523
package_name, testname = test_key
523524
status = "??"
524525
for action in ACTIONS_WITH_ICON:
525526
if action in items.values():
526-
status = action[:2]
527+
status, info = action[:2], action[2:]
528+
summary[info] = summary.get(info, 0) + 1
527529
break
528530
items_proc = dict((k, short_action(v)) for (k, v) in items.items())
529531
table.append(
@@ -535,7 +537,8 @@ def key(column):
535537
)
536538
table_txt = format_table(table, markdown=markdown)
537539
if len(table) > 5:
538-
table_txt = wrap_in_details(table_txt, f"{len(table)} failing tests:")
540+
summary_msg = make_summary_message(table, summary)
541+
table_txt = wrap_in_details(table_txt, summary_msg)
539542
if table_txt:
540543
print(table_txt)
541544

@@ -584,6 +587,13 @@ def key(column):
584587
print()
585588

586589

590+
def make_summary_message(table, summary):
591+
items = list(summary.items())
592+
items.sort(key=lambda x: x[1], reverse=True)
593+
items = ", ".join(f"{count} {info}" for (info, count) in items)
594+
return f"{len(table)} interesting tests: " + items
595+
596+
587597
# For test table, use shorter version of action.
588598
# We have full action name in env table, so that is used as agenda.
589599
def short_action(action):

0 commit comments

Comments
 (0)