Skip to content

Commit 1222ade

Browse files
committed
output markdown
1 parent 594173c commit 1222ade

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

scripts/ci/twister_report_analyzer.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,18 @@ def add_counter(self, key: str, test: str = '') -> None:
7474
self.counters[key] = self.counters.get(key, TestCollection())
7575
self.counters[key].append(test)
7676

77-
def print_counters(self, indent: int = 0):
77+
def print_counters(self, indent= 0, f=None):
78+
i = 0
7879
for key, value in self.counters.items():
79-
print(f'{" " * indent}{value.quantity:4} {key}')
80+
if indent == 0:
81+
f.write("\n")
82+
f.write(f'| {value.quantity:4} | {key} |\n')
83+
if i == 0 and indent == 0:
84+
f.write('|-------|------|\n')
85+
i = 1
8086
if value.subcounters.counters:
81-
value.subcounters.print_counters(indent + 4)
87+
value.subcounters.print_counters(indent + 1, f)
88+
i = 0
8289

8390
def sort_by_quantity(self):
8491
self.counters = dict(
@@ -338,7 +345,8 @@ def main():
338345
reports.status.print_counters()
339346
if args.long_summary:
340347
print('\nErrors summary:')
341-
reports.errors.print_counters()
348+
with open("file.txt", "w") as f:
349+
reports.errors.print_counters(f=f)
342350
else:
343351
summary_with_most_common_errors(reports.errors)
344352

0 commit comments

Comments
 (0)