Commit f3c5369f authored by Grégory Wisniewski's avatar Grégory Wisniewski

Test runner exit with a non-zero code if there are failures or errors.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1997 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent c5eb6391
......@@ -287,9 +287,9 @@ class NeoTestRunner(unittest.TestResult):
self.time = sum([s.time for s in self.modulesStats.values()])
args = (self.testsRun, len(self.errors), len(self.failures))
self.subject = "Neo : %s Tests, %s Errors, %s Failures" % args
self.summary = self._buildSummary()
self.errors = self._buildErrors()
self.warnings = self._buildWarnings()
self._summary = self._buildSummary()
self._errors = self._buildErrors()
self._warnings = self._buildWarnings()
def sendReport(self, smtp_server, sender, recipients):
""" Send a mail with the report summary """
......@@ -312,7 +312,7 @@ class NeoTestRunner(unittest.TestResult):
msg['X-ERP5-Tests-Status'] = 'OK'
# write the body
body = MIMEText(self.summary + self.warnings + self.errors)
body = MIMEText(self._summary + self._warnings + self._errors)
msg.attach(body)
# attach the log file
......@@ -363,10 +363,13 @@ if __name__ == "__main__":
# build report
runner.build()
print runner.errors
print runner.warnings
print runner.summary
print runner._errors
print runner._warnings
print runner._summary
# send a mail
if options.sender:
runner.sendReport(mail_server, options.sender, options.recipient)
if not runner.wasSuccessful():
sys.exit(1)
sys.exit(0)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment