Skip to content

Commit

Permalink
src/test_report: optimize TestReport._get_report method
Browse files Browse the repository at this point in the history
As the API design has been involved over time,
we have eliminated `incomplete` from the set of
possible values for `Node.result` field.
Optimize method to get reports accordingly.
Also, remove the unnecessary parenthesis from a
line.

Signed-off-by: Jeny Sadadia <[email protected]>
  • Loading branch information
Jeny Sadadia authored and gctucker committed Aug 9, 2023
1 parent 1fba31b commit ee92c8b
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,15 @@ def _get_report(self, root_node):
)
template = template_env.get_template("test-report.jinja2")
revision = root_node['revision']
if root_node['result'] == 'incomplete':
subject = (f"\
results = self._get_results_data(root_node)
stats = results['stats']
groups = results['groups']
subject = f"\
[STAGING] {revision['tree']}/{revision['branch']} {revision['describe']}: \
Failed to create source tarball for {root_node['name']}")
content = template.render(
subject=subject, root=root_node, groups={}
)
else:
results = self._get_results_data(root_node)
stats = results['stats']
groups = results['groups']
subject = (f"\
[STAGING] {revision['tree']}/{revision['branch']} {revision['describe']}: \
{stats['total']} runs {stats['failures']} failures")
content = template.render(
subject=subject, root=root_node, groups=groups
)
{stats['total']} runs {stats['failures']} failures"
content = template.render(
subject=subject, root=root_node, groups=groups
)
return content, subject

def _send_report(self, subject, content):
Expand Down

0 comments on commit ee92c8b

Please sign in to comment.