[Zope-CVS] CVS: Packages/TestScripts - autotester.py:1.9

Chris Withers chrisw@nipltd.com
Fri, 19 Apr 2002 10:52:15 -0400


Update of /cvs-repository/Packages/TestScripts
In directory cvs.zope.org:/tmp/cvs-serv17411

Modified Files:
	autotester.py 
Log Message:
More accurate notification of numbers of failures and errors.

=== Packages/TestScripts/autotester.py 1.8 => 1.9 ===
 
 # send the mail
-failed_re = compile('OVERALL FAILED \(total failures=(?P<failed>\d+)(?:, total errors=(?P<errored>\d+))?')
+failed_re = compile('FAILED \(failures=(\d+)(?:, errors=(\d+))?')
 email = config['email'][0]
 for address,body in emails.items():    
     subject = email['subject'][0]()
     content = body.getvalue()
-    m = failed_re.search(content)
-    if m:
-        for key,value in m.groupdict().items():
-            if value:
-                subject += ', %s %s' % (value,key)
+
+    failures = 0
+    errors = 0
+    for f, e in failed_re.findall(content):
+        if f:
+            failures += int(f)
+        if e:
+            errors += int(e)
+    
+    if failures:
+        subject += ' failures:' + `failures`
+    if errors:
+        subject += ' errors:' + `errors`
+    if not(errors or failures):
+        subject += ' OK :-)'
+
     send(address,
          subject,
          content,