From 28ea3e4d0bca3340a29848333f1ff441e86c8530 Mon Sep 17 00:00:00 2001 From: kurilova Date: Fri, 6 Feb 2026 10:53:55 +0000 Subject: [PATCH] Adds html report --- modules/test/dns/python/src/dns_module.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/test/dns/python/src/dns_module.py b/modules/test/dns/python/src/dns_module.py index 5c23919f1..06f346f76 100644 --- a/modules/test/dns/python/src/dns_module.py +++ b/modules/test/dns/python/src/dns_module.py @@ -22,6 +22,7 @@ LOG_NAME = 'test_dns' MODULE_REPORT_FILE_NAME = 'dns_report.j2.html' +MODULE_REPORT_STYLED_FILE_NAME = 'dns_report.jinja2' DNS_SERVER_CAPTURE_FILE = '/runtime/network/dns.pcap' STARTUP_CAPTURE_FILE = '/runtime/device/startup.pcap' MONITOR_CAPTURE_FILE = '/runtime/device/monitor.pcap' @@ -161,6 +162,7 @@ def generate_module_report(self): pages_content.append(current_page_rows) report_html = '' + report_jinja_preview = '' if not pages_content: pages_content = [[]] @@ -175,9 +177,23 @@ def generate_module_report(self): module_data=page_rows ) report_html += page_html + page_html = template.render( + base_template=self._base_template_file_preview, + module_header=module_header_repr, + summary_headers=summary_headers, + summary_data=summary_data, + module_data_headers=module_data_headers, + module_data=page_rows + ) + report_jinja_preview += page_html LOGGER.debug('Module report:\n' + report_html) + # Generate styled report for a preview + jinja_path_styled = os.path.join( + self._results_dir, MODULE_REPORT_STYLED_FILE_NAME) + self._render_styled_report(report_jinja_preview, jinja_path_styled) + # Use os.path.join to create the complete file path report_path = os.path.join(self._results_dir, MODULE_REPORT_FILE_NAME)