本文整理汇总了Python中HTMLTestRunner.html方法的典型用法代码示例。如果您正苦于以下问题:Python HTMLTestRunner.html方法的具体用法?Python HTMLTestRunner.html怎么用?Python HTMLTestRunner.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLTestRunner
的用法示例。
在下文中一共展示了HTMLTestRunner.html方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import HTMLTestRunner [as 别名]
# 或者: from HTMLTestRunner import html [as 别名]
def run(self, test):
"Run the given test case or test suite."
result = _TestResult(self.verbosity)
try:
test(result)
except KeyboardInterrupt:
logging.error("Test Runner interrupted by user")
except Exception:
logging.error(traceback.format_exc())
self.stopTime = datetime.datetime.now().replace(microsecond=0)
self.generateReport(test, result)
totalNbr = result.error_count + result.failure_count + result.skip_count + result.success_count
logging.info('---------------------------------------')
logging.info('Run ' + str(totalNbr) + ' tests in time %s' %(self.stopTime-self.startTime))
logging.info('Error ' + str(result.error_count) +
', Failed ' + str(result.failure_count) +
', Skipped ' + str(result.skip_count) +
', Success ' + str(result.success_count))
if xunitReport:
base = os.path.splitext(self.stream.name)[0] #stream = c:\...\Report.html, base = Report
directory = os.path.dirname(self.stream.name)
xunitFile = base + ".xml"
result.xunit.report(xunitFile)
#copy file for jenkins with the unambiguous location e.i. result directory
#shutil.copy2(xunitFile, os.path.join(directory, '..'))
return result