Skip to content

Commit

Permalink
Test-reporting bugfix (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Hofer authored Apr 3, 2023
1 parent 06e75fc commit 80f52a6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/report_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def append(self, status: str, log_file: str, comment: str = '') -> None:
link = HTML.link(Path(log_file).stem, self.artifact_path + log_file)
self.body.append([status, f'{link} {comment}'])

def clear(self) -> None:
self.body = []

def __str__(self) -> str:
return HTML.table(self.head, self.body)

Expand Down Expand Up @@ -51,9 +54,10 @@ def __str__(self) -> str:
'timed out after 5 seconds'),
]

comment = Markdown.header(machine_name(), level=3)
report = Markdown.header(machine_name(), level=3)
any_tests_ran_on_machine = False
for test_type in ['unit', 'integration', 'system']:
table.clear()
all_tests_of_type_passed = True
any_tests_of_type = False
for file_name in sorted(
Expand All @@ -79,13 +83,13 @@ def __str__(self) -> str:
icon = ':green_circle:'
else:
icon = ':red_circle:'
comment += HTML.collapsible(f'{icon} {test_type} test', table)
report += HTML.collapsible(f'{icon} {test_type} test', table)

if test_type == 'system' and not os.path.isfile(
f'log/{machine_name()}/system_test/serial_test_run'):
comment += '\n\n**WARNING**: Serial tests did not run for system tests'
report += '\n\n**WARNING**: Serial tests did not run for system tests'

if not any_tests_ran_on_machine:
comment += f'No tests executed.'
report += f'No tests executed.'

repo.comment(args.issue_id, comment)
repo.comment(args.issue_id, report)

0 comments on commit 80f52a6

Please sign in to comment.