HTMLTestRunner修改成Python3版本

下载地址:

HTMLTestRunner下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html

BSTestRunner     下载地址:https://github.com/easonhan007/HTMLTestRunner

由于HTMLTestRunner只对python2.7支持,要支持python3.X,需要对本文件进行修改

下载文件后,打开文件进行修改

步骤:

第94行,将import StringIO修改成import io

第539行,将self.outputBuffer = StringIO.StringIO()修改成self.outputBuffer = io.StringIO()

第642行,将if not rmap.has_key(cls):修改成if not cls in rmap:

第766行,将uo = o.decode('latin-1')修改成uo = o

第775行,将ue = e.decode('latin-1')修改成ue = e

第631行,将print >> sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)修改成print(sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime))

第778行,script = self.REPORT_TEST_OUTPUT_TMPL % dict(
              id = tid,
              output = saxutils.escape(str(uo)+ue),    这里最好把uo加一个str,不然可能会出现类型问题

最后将文件保存至python目录下Lib下,就可直接调用

参考文档:https://blog.csdn.net/chailyn_feng/article/details/78233163

                 https://www.cnblogs.com/feiquan/p/8525903.html

       https://www.cnblogs.com/wm1012/p/6554344.html

猜你喜欢

转载自www.cnblogs.com/qiuzhi2018/p/9456162.html