[Zope-CVS] CVS: Packages/TestScripts - autotester.py:1.12
Chris Withers
chrisw@nipltd.com
Mon, 29 Jul 2002 12:01:07 -0400
Update of /cvs-repository/Packages/TestScripts
In directory cvs.zope.org:/tmp/cvs-serv29506
Modified Files:
autotester.py
Log Message:
notify someone when things explode.
=== Packages/TestScripts/autotester.py 1.11 => 1.12 ===
# Sandbox path
sandbox = config['sandbox'][0]()
+# stuff we always need to send emails
+email = config['email'][0]
+smtp_server=email['smtp'][0]()
+from_address=email['from'][0]()
+
# The emails to send (email address->StringIO object)
emails={}
@@ -64,7 +69,11 @@
# get our original directory
home = getcwd()
-for scenario in config['scenario']:
+try: # catch-all for death and badness
+
+ raise 'BArf!'
+
+ for scenario in config['scenario']:
# blow away the sandbox
chdir(home)
@@ -148,10 +157,9 @@
body.write(test_result.strip())
body.write('\n')
-# send the mail
-failed_re = compile('FAILED \(failures=(\d+)(?:, errors=(\d+))?')
-email = config['email'][0]
-for address,body in emails.items():
+ # send the mail
+ failed_re = compile('FAILED \(failures=(\d+)(?:, errors=(\d+))?')
+ for address,body in emails.items():
subject = email['subject'][0]()
content = body.getvalue()
@@ -177,6 +185,19 @@
send(address,
subject,
content,
- smtp_server=email['smtp'][0](),
- from_address=email['from'][0]())
+ smtp_server=smtp_server,
+ from_address=from_address)
body.close()
+
+except:
+
+ # oh dear, badness happened, better whine.
+ from sys import exc_info
+ from traceback import format_exception
+ send(from_address,
+ 'Autotester.py failed',
+ '\n'.join(format_exception(*exc_info())),
+ smtp_server=smtp_server,
+ from_address=from_address)
+
+