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

Chris Withers chrisw@nipltd.com
Mon, 15 Apr 2002 11:26:51 -0400


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

Modified Files:
	autotester.py 
Log Message:
Added subject line change suggested by Steve A. Also left a handy print statement in for when people b0rk things.

=== Packages/TestScripts/autotester.py 1.7 => 1.8 ===
 from StringIO import StringIO
 from threading import Thread
+from re import compile
 
 class NonBlockingReader(Thread):
 
@@ -100,7 +101,7 @@
         # change dir to the right place
         chdir(join(sandbox,location))
         # do the checkout
-        system(config['cvs'][0]['command'][0]()+" -z6 export -r "+tag+" -d "+name+" "+module)
+        system(config['cvs'][0]['command'][0]()+" -z9 export -r "+tag+" -d "+name+" "+module)
 
     # get the python command
     p = config['python'][0][scenario['python'][0]()][0]()
@@ -116,6 +117,7 @@
     
     # execute the build command
     build_result = xml_execute(scenario['build'],p)
+    print build_result
         
     # run the tests
     test_result = xml_execute(scenario['test'],p)
@@ -149,11 +151,19 @@
     body.write('\n')
 
 # send the mail
+failed_re = compile('OVERALL FAILED \(total failures=(?P<failed>\d+)(?:, total errors=(?P<errored>\d+))?')
 email = config['email'][0]
-for address,body in emails.items():
+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)
     send(address,
-         email['subject'][0](),
-         body.getvalue(),
+         subject,
+         content,
          smtp_server=email['smtp'][0](),
          from_address=email['from'][0]())
     body.close()