本文整理匯總了Python中TestRunner.cat方法的典型用法代碼示例。如果您正苦於以下問題:Python TestRunner.cat方法的具體用法?Python TestRunner.cat怎麽用?Python TestRunner.cat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TestRunner
的用法示例。
在下文中一共展示了TestRunner.cat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: handleUpdate
# 需要導入模塊: import TestRunner [as 別名]
# 或者: from TestRunner import cat [as 別名]
def handleUpdate(self, index, tr):
if self.progressBar:
if tr.failed():
self.progressBar.clear()
else:
# Force monotonicity
self.progress = max(self.progress, float(index)/self.numTests)
self.progressBar.update(self.progress, tr.path)
return
elif self.opts.succinct:
if not tr.failed():
sys.stdout.write('.')
sys.stdout.flush()
return
else:
sys.stdout.write('\n')
extra = ''
if tr.code==TestStatus.Invalid:
extra = ' - (Invalid test)'
elif tr.code==TestStatus.NoRunLine:
extra = ' - (No RUN line)'
elif tr.failed():
extra = ' - %s'%(TestStatus.getName(tr.code).upper(),)
print '%*d/%*d - %s%s'%(self.digits, index+1, self.digits,
self.numTests, tr.path, extra)
if tr.failed() and self.opts.showOutput:
TestRunner.cat(tr.testResults, sys.stdout)
示例2: handleUpdate
# 需要導入模塊: import TestRunner [as 別名]
# 或者: from TestRunner import cat [as 別名]
def handleUpdate(self, index, tr):
if self.progressBar:
if tr.failed():
self.progressBar.clear()
else:
# Force monotonicity
self.progress = max(self.progress, float(index)/self.numTests)
self.progressBar.update(self.progress, tr.path)
return
elif self.opts.succinct:
if not tr.failed():
sys.stdout.write('.')
sys.stdout.flush()
return
else:
sys.stdout.write('\n')
extra = ''
if tr.code==TestStatus.Invalid:
extra = ' - (Invalid test)'
elif tr.code==TestStatus.NoRunLine:
extra = ' - (No RUN line)'
elif tr.failed():
extra = ' - %s'%(TestStatus.getName(tr.code).upper(),)
print '%*d/%*d - %s%s'%(self.digits, index+1, self.digits,
self.numTests, tr.path, extra)
if tr.failed():
msgs = []
if tr.warnings:
msgs.append('%d warnings'%(len(tr.warnings),))
if tr.errors:
msgs.append('%d errors'%(len(tr.errors),))
if tr.assertions:
msgs.append('%d assertions'%(len(tr.assertions),))
if msgs:
print '\tFAIL (%s)'%(', '.join(msgs))
for i,error in enumerate(set([e for (_,_,_,e) in tr.errors])):
print '\t\tERROR: %s'%(error,)
if i>20:
print '\t\t\t(too many errors, skipping)'
break
for assertion in set(tr.assertions):
print '\t\tASSERTION: %s'%(assertion,)
if self.opts.showOutput:
TestRunner.cat(tr.testResults, sys.stdout)