1.在自己的测试脚本中加入下面的代码并保存:
# -.- coding:utf-8 -.-
import sys
reload(sys)
sys.setdefaultencoding(‘utf-8‘)
2.打开HTMLTestRunner.py,修改其中的第777行和第783行,将其中的编码“latin-1”修改为“utf-8”后保存,具体如下所示:
if isinstance(o,str):
# TODO: some problem with ‘string_escape‘: it escape \n and mess up formating
# uo = unicode(o.encode(‘string_escape‘))
uo = o.decode(‘utf-8‘)
else:
uo = o
if isinstance(e,str):
# TODO: some problem with ‘string_escape‘: it escape \n and mess up formating
# ue = unicode(e.encode(‘string_escape‘))
ue = e.decode(‘utf-8‘)
else:
ue = e
时间: 2024-10-03 22:41:52