- pass around the assertion_report to the YAML importer - removed TestReport, which was identical to assertion_report - assertion_report is simpler (no more severity level) - use the report to log a greppable sentence when some test failed. Previously the runbot had to grep for a Traceback which was an unreliable technique (e.g. an exception can be purposefuly generated as part of a test and the associated traceback visible in the logs). Now it can grep "At least one test failed when loading the modules". bzr revid: vmt@openerp.com-20120302110227-nqrl7i46ju28ntdr
30 lines
766 B
Python
30 lines
766 B
Python
|
|
class assertion_report(object):
|
|
"""
|
|
Simple pair of success and failures counts (used to record YAML and XML
|
|
`assert` tags as well as unittest2 tests outcome (in this case, not
|
|
individual `assert`)).
|
|
"""
|
|
def __init__(self):
|
|
self.successes = 0
|
|
self.failures = 0
|
|
|
|
def record_success(self):
|
|
self.successes += 1
|
|
|
|
def record_failure(self):
|
|
self.failures += 1
|
|
|
|
def record_result(self, result):
|
|
if result is None:
|
|
pass
|
|
elif result is True:
|
|
self.record_success()
|
|
elif result is False:
|
|
self.record_failure()
|
|
|
|
def __str__(self):
|
|
res = 'Assertions report: %s successes, %s failures' % (self.successes, self.failures)
|
|
return res
|
|
|