1、Unittests in
1、选择Edit Configurations......
2、删除Unittestsxx所有测试
3、
将py文件添加到python下。
添加方式 选中python,点击+号,选择python。在script path选择对应位置点击OK。即可运行HTMLTestRunner
1、AttributeError: type object '_io.StringIO' has no attribute 'StringIO'
2、AttributeError: 'dict' object has no attribute 'has_key'
3、 AttributeError: 'str' object has no attribute 'decode'
4、_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'
以上问题与python2和python3有关
第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 = e
第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))修改为sys.stderr.write('\nTime Elapsed: %s\n' % (self.stopTime - self.startTime))