diff options
Diffstat (limited to 'conftest.py')
-rw-r--r-- | conftest.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/conftest.py b/conftest.py index eade841..5dea9a4 100644 --- a/conftest.py +++ b/conftest.py @@ -36,8 +36,15 @@ def setup_compress_function(): json.dump(summary_data,summary_file,indent=4,sort_keys=False) summary_file.close() + #Get zip file name + issue = subprocess.getoutput('cat /etc/issue') + version = issue[23:-7] + machine_name = subprocess.getoutput('uname -n') + date = subprocess.getoutput('date +%Y%m%d') + zip_name = "agl-test-log-" + version + '-' + machine_name + '-' + date + #Creat summary report in html - html = get_summary_report_html(summary_data) + html = get_summary_report_html(summary_data,zip_name) html_path = TMP_LOGS_DIR + "test-report/summary-report.html" html_file = open(html_path,"w") html_file.write(html) @@ -49,14 +56,10 @@ def setup_compress_function(): shutil.copyfile(source_file,target_file) #Package the test report - #TODO The name of the zip file is formatted as follows: - # agl-test-log-13.0.1-raspberrypi4-20200808.zip - base_name = REPORT_LOGS_DIR + "agl-test-log-xxx" + base_name = REPORT_LOGS_DIR + zip_name root_dir = TMP_LOGS_DIR + "test-report" shutil.make_archive(base_name,"zip",root_dir) - # TODO: - # Upload the final log to Artifactorial #Summarize all reports.json file def get_summary_data(report_files): @@ -107,7 +110,7 @@ def get_summary_data(report_files): return summary_data #Generate content for summary report json file -def get_summary_report_html(summary_data): +def get_summary_report_html(summary_data,zip_name): status = "fail" if(summary_data["summary"]["summary_total"]==summary_data["summary"]["summary_passed"]): status = "success" @@ -163,7 +166,7 @@ def get_summary_report_html(summary_data): html = html + "<font>Detail log :</font>" #TODO update the link address for agl-test-log-xxx.zip html = html + "<a href=\"" + "address of agl-test-log-xxx.zip " - html = html + "\">agl-test-log-13.0.1-raspberrypi4-20200808.zip</a>" + html = html + "\">" + zip_name + ".zip</a>" html = html + "</body>" html = html + "</html>" |