[Neo-report] r1997 gregory - /trunk/tools/runner

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 1 18:21:15 CEST 2010


Author: gregory
Date: Thu Apr  1 18:21:13 2010
New Revision: 1997

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

Modified:
    trunk/tools/runner

Modified: trunk/tools/runner
==============================================================================
--- trunk/tools/runner [iso-8859-1] (original)
+++ trunk/tools/runner [iso-8859-1] Thu Apr  1 18:21:13 2010
@@ -287,9 +287,9 @@
         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 @@
           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 @@
 
     # 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)





More information about the Neo-report mailing list