bugfix open and write file: make compatible with Python 2.7

This commit is contained in:
debugtalk
2018-02-25 23:15:32 +08:00
parent 160218b1ed
commit 81457dea93

View File

@@ -1,3 +1,4 @@
import io
import os
import time
import unittest
@@ -141,7 +142,7 @@ class HtmlTestResult(unittest.TextTestResult):
os.makedirs(report_dir_path)
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)
fp.write(rendered_content)