mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-11 02:39:46 +08:00
bugfix open and write file: make compatible with Python 2.7
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import io
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
@@ -141,7 +142,7 @@ class HtmlTestResult(unittest.TextTestResult):
|
|||||||
os.makedirs(report_dir_path)
|
os.makedirs(report_dir_path)
|
||||||
|
|
||||||
report_path = os.path.join(report_dir_path, html_report_name)
|
report_path = os.path.join(report_dir_path, html_report_name)
|
||||||
with open(report_path, 'w', encoding='utf-8') as fp:
|
with io.open(report_path, 'w', encoding='utf-8') as fp:
|
||||||
rendered_content = Template(template_content).render(summary)
|
rendered_content = Template(template_content).render(summary)
|
||||||
fp.write(rendered_content)
|
fp.write(rendered_content)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user