From 84256d931a4e9db4121bf79e3f82e63b6196393a Mon Sep 17 00:00:00 2001 From: httprunner Date: Tue, 27 Nov 2018 22:29:39 +0800 Subject: [PATCH] fix: make render_html_report API public --- httprunner/report.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/httprunner/report.py b/httprunner/report.py index 65dbd183..f8aca25e 100644 --- a/httprunner/report.py +++ b/httprunner/report.py @@ -81,10 +81,6 @@ def aggregate_stat(origin_stat, new_stat): def stringify_summary(summary): """ stringify summary, in order to dump json file and generate html report. """ - start_at_timestamp = int(summary["time"]["start_at"]) - summary["time"]["start_datetime"] = datetime.fromtimestamp(start_at_timestamp).strftime('%Y-%m-%d %H:%M:%S') - summary["html_report_name"] = "{}.html".format(start_at_timestamp) - for index, suite_summary in enumerate(summary["details"]): if not suite_summary.get("name"): @@ -280,7 +276,10 @@ def render_html_report(summary, report_template=None, report_dir=None): if not os.path.isdir(report_dir): os.makedirs(report_dir) - report_path = os.path.join(report_dir, summary["html_report_name"]) + start_at_timestamp = int(summary["time"]["start_at"]) + summary["time"]["start_datetime"] = datetime.fromtimestamp(start_at_timestamp).strftime('%Y-%m-%d %H:%M:%S') + + report_path = os.path.join(report_dir, "{}.html".format(start_at_timestamp)) with io.open(report_template, "r", encoding='utf-8') as fp_r: template_content = fp_r.read()