diff --git a/httprunner/__about__.py b/httprunner/__about__.py index 792bf03a..a5a8532d 100644 --- a/httprunner/__about__.py +++ b/httprunner/__about__.py @@ -1,7 +1,7 @@ __title__ = 'HttpRunner' __description__ = 'One-stop solution for HTTP(S) testing.' __url__ = 'https://github.com/HttpRunner/HttpRunner' -__version__ = '1.5.2' +__version__ = '1.5.3' __author__ = 'debugtalk' __author_email__ = 'mail@debugtalk.com' __license__ = 'MIT' diff --git a/httprunner/report.py b/httprunner/report.py index 7b5220db..23b2bd64 100644 --- a/httprunner/report.py +++ b/httprunner/report.py @@ -49,7 +49,7 @@ def get_summary(result): if getattr(result, "records", None): summary["time"] = { - 'start_at': datetime.fromtimestamp(result.start_at), + 'start_at': result.start_at, 'duration': result.duration } summary["records"] = result.records @@ -77,14 +77,15 @@ def render_html_report(summary, html_report_name=None, html_report_template=None logger.log_debug("render data: {}".format(summary)) report_dir_path = os.path.join(os.getcwd(), "reports") - start_datetime = summary["time"]["start_at"].strftime('%Y-%m-%d-%H-%M-%S') + start_at_timestamp = int(summary["time"]["start_at"]) + summary["time"]["start_datetime"] = datetime.fromtimestamp(start_at_timestamp).strftime('%Y-%m-%d %H:%M:%S') if html_report_name: summary["html_report_name"] = html_report_name report_dir_path = os.path.join(report_dir_path, html_report_name) - html_report_name += "-{}.html".format(start_datetime) + html_report_name += "-{}.html".format(start_at_timestamp) else: summary["html_report_name"] = "" - html_report_name = "{}.html".format(start_datetime) + html_report_name = "{}.html".format(start_at_timestamp) if not os.path.isdir(report_dir_path): os.makedirs(report_dir_path) diff --git a/httprunner/templates/default_report_template.html b/httprunner/templates/default_report_template.html index e72587b0..06941c1a 100644 --- a/httprunner/templates/default_report_template.html +++ b/httprunner/templates/default_report_template.html @@ -150,7 +150,7 @@