From 83089bbc3fe3dddbe229c7575f623e0caaec45bd Mon Sep 17 00:00:00 2001 From: Piotr Narajowski Date: Tue, 14 Jan 2025 17:47:40 +0100 Subject: [PATCH] bot: report: add test group summary to readme.md 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 --- autopts/bot/common.py | 5 ++++- autopts/bot/common_features/mail.py | 16 +++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/autopts/bot/common.py b/autopts/bot/common.py index 33d3906d9a..6848f633a7 100644 --- a/autopts/bot/common.py +++ b/autopts/bot/common.py @@ -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) @@ -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: @@ -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'], diff --git a/autopts/bot/common_features/mail.py b/autopts/bot/common_features/mail.py index aaf7e35c1e..5eb474b376 100644 --- a/autopts/bot/common_features/mail.py +++ b/autopts/bot/common_features/mail.py @@ -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 @@ -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""" @@ -123,14 +121,14 @@ def profile_summary_html(tc_results): suite_summary = f"""

Test Group/Profile Summary

- +
- - - - - + + + + +
SuiteTotalPassFailPass RateSuiteTotalPassFailPass Rate