Skip to content

Commit

Permalink
bot: report: add test group summary to readme.md
Browse files Browse the repository at this point in the history
Previously implemented profile_summary function is now used
to write to readme.md file in Github logging repo and AutoPTS
test session result email. Table width is now adjusted to be displayed
properly on various screens
  • Loading branch information
piotrnarajowski committed Jan 15, 2025
1 parent 8afae46 commit 83089bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 4 additions & 1 deletion autopts/bot/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ def make_readme_md(self, readme_md_path, report_data):
"""Creates README.md for Github logging repo
"""
readme_file = readme_md_path
profile_summary = mail.profile_summary(report_data['tc_results'])

Path(os.path.dirname(readme_file)).mkdir(parents=True, exist_ok=True)

Expand All @@ -585,6 +586,8 @@ def make_readme_md(self, readme_md_path, report_data):
End time: {report_data["end_time_stamp"]}
PTS version: {report_data["pts_ver"]}
{profile_summary}
Repositories:
Expand Down Expand Up @@ -704,7 +707,7 @@ def send_email(self, report_data):
mail_ctx = {'project_name': report_data['project_name'],
'repos_info': report_data['repo_status'],
'summary': [mail.status_dict2summary_html(report_data['status_count'])],
'profile_summary': mail.profile_summary_html(report_data['tc_results']),
'profile_summary': mail.profile_summary(report_data['tc_results']),
'log_url': [],
'board': self.bot_config['auto_pts']['board'],
'platform': report_data['platform'],
Expand Down
16 changes: 7 additions & 9 deletions autopts/bot/common_features/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_pass_rate(self):
self.pass_rate = (self.passed / float(self.total)) * 100


def profile_summary_html(tc_results):
def profile_summary(tc_results):
"""Creates HTML formatted message with summarized profile results"""

"""Dictionary containing profile name as key, test group object as value
Expand All @@ -106,8 +106,6 @@ def profile_summary_html(tc_results):
for tg in test_groups.values():
tg.get_pass_rate()

# Generate table

table_rows = ""
for suite, stats in test_groups.items():
table_rows += f"""
Expand All @@ -123,14 +121,14 @@ def profile_summary_html(tc_results):
suite_summary = f"""
<div>
<h3>Test Group/Profile Summary</h3>
<table border="1" style="border-collapse: collapse; width: 100%;">
<table border="1" style="border-collapse: collapse; text-align: center;">
<thead>
<tr>
<th>Suite</th>
<th>Total</th>
<th>Pass</th>
<th>Fail</th>
<th>Pass Rate</th>
<th width="10em">Suite</th>
<th width="10em">Total</th>
<th width="10em">Pass</th>
<th width="10em">Fail</th>
<th width="10em">Pass Rate</th>
</tr>
</thead>
<tbody>
Expand Down

0 comments on commit 83089bb

Please sign in to comment.