change: html report name defaults to be in UTC ISO 8601 format

This commit is contained in:
debugtalk
2019-12-29 18:48:06 +08:00
parent 9ada11add5
commit e2d0b03cf0
2 changed files with 9 additions and 4 deletions

View File

@@ -1,11 +1,15 @@
# Release History
## 2.4.9 (2019-12-26)
## 2.4.9 (2019-12-29)
**Added**
- test: add unittest for cli
**Changed**
- change: html report name defaults to be in UTC ISO 8601 format
**Fixed**
- fix: display validators in report when validate raised exception

View File

@@ -33,15 +33,16 @@ def gen_html_report(summary, report_template=None, report_dir=None, report_file=
logger.log_info("Start to render 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')
start_at_timestamp = summary["time"]["start_at"]
utc_time_iso_8601_str = datetime.utcfromtimestamp(start_at_timestamp).isoformat()
summary["time"]["start_datetime"] = utc_time_iso_8601_str
if report_file:
report_dir = os.path.dirname(report_file)
report_file_name = os.path.basename(report_file)
else:
report_dir = report_dir or os.path.join(os.getcwd(), "reports")
report_file_name = "{}.html".format(int(start_at_timestamp * 1000))
report_file_name = "{}.html".format(utc_time_iso_8601_str)
if not os.path.isdir(report_dir):
os.makedirs(report_dir)