2019-07-29

python中解决ModuleNotFoundError No module named 'HTMLTestRunner'

官网下载HTMLTestRunner.把HTMLTestRunnter放在python安装路径lib下面

python3需要更改HTMLTestRunnter几处

第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.decode('utf-8');

第772行,将ue = e.decode(‘latin-1‘)修改成ue = e.decode('utf-8');

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

你可能感兴趣的:(2019-07-29)