[Zope-CVS] CVS: Packages/TestScripts - autotester.py:1.15
Chris Withers
chrisw@nipltd.com
Mon, 7 Oct 2002 13:57:49 -0400
Update of /cvs-repository/Packages/TestScripts
In directory cvs.zope.org:/tmp/cvs-serv16854
Modified Files:
autotester.py
Log Message:
More generic r.e. to catch errors. Warning for too much output and warning for 'error' and 'warning' keywords in body.
=== Packages/TestScripts/autotester.py 1.14 => 1.15 ===
--- Packages/TestScripts/autotester.py:1.14 Tue Jul 30 08:12:25 2002
+++ Packages/TestScripts/autotester.py Mon Oct 7 13:57:49 2002
@@ -13,7 +13,7 @@
from xml2dict import xml2dict
from StringIO import StringIO
from threading import Thread
-from re import compile
+from re import compile, I
class NonBlockingReader(Thread):
@@ -61,7 +61,7 @@
i.close()
c.close()
e.close()
- return result
+ return result
def xml_execute(command,p):
command = command[0]
@@ -156,30 +156,37 @@
emails.append((address,body,scenario().strip()))
# send the mail
- failed_re = compile('FAILED \(failures=(\d+)(?:, errors=(\d+))?')
+ failed_re = compile('FAILED \((?:failures=(\d+))?(?:, )?(?:errors=(\d+))?')
+ other_errors_re = compile('error|warning',I)
for address,body,name in emails:
subject = email['subject'][0]()+ ' - ' + name + ' - '
content = body.getvalue()
- 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 :-)'
-
n = 10000
if len(content)>n:
content = content[:n] + '\n<truncated>'
-
+ subject += ' Too many errors :-('
+ else:
+ 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 errors or failures:
+ pass
+ elif other_errors_re.findall(content)):
+ subject += ' Not OK :-('
+ else:
+ subject += ' OK :-)'
+
send(address,
subject,
content,