def buildResultClass(args):
"""Build a Result Class to use in the testcase execution"""
class StampedResult(unittest.TextTestResult):
"""
Custom TestResult that prints the time when a test starts. As toaster-auto
can take a long time (ie a few hours) to run, timestamps help us understand
what tests are taking a long time to execute.
"""
def startTest(self, test):
import time
self.stream.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + " - ")
super(StampedResult, self).startTest(test)
return StampedResult
评论列表
文章目录