HTMLTestRunner下載地址:http://tungwaiyip.info/software/HTMLTestRunner.html
- 首先根據(jù)這個鏈接下載文件到Python下的Lib目錄下的site-packages;
- shell 模式下輸入
import HTMLTestRunner不報錯就證明安裝好了 - 然后這個是不支持python3語法的,要自己改一下代碼,具體更改如下;
第94行: import StringIO 改為 import io
第539行:self.outputBuffer = StringIO.StringIO() 改為self.outputBuffer = io.BytesIO()
第642行:if not rmap.has_key(cls): 改為 if not cls in rmap:
第772行:ue = e.decode('latin-1') 改成 ue = e
第776行:uo = o.decode ('latin-1') 改成 uo=o
第768行:uo = o 改成 uo = o.decode('utf-8')
第774行:ue = e 改成 ue = e.decode('utf-8')
第631行:print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime) 改成 print('\nTime Elapsed: %s' % (self.stopTime-self.startTime),file=sys.stderr)
第118行:self.fp.write(s) 改為 self.fp.write(bytes(s,'UTF-8'))
HTMLTestRunner_PY3下載地址:https://github.com/huilansame/HTMLTestRunner_PY3
這是一個直接支持Python3的HTMLTestRunner文件