launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02278
[Merge] lp:~stub/launchpad/trivial into lp:launchpad
Stuart Bishop has proposed merging lp:~stub/launchpad/trivial into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#660770 root logger in tests is very noisy
https://bugs.launchpad.net/bugs/660770
#687951 Large number of DBs left around after test suite runs in buildbot
https://bugs.launchpad.net/bugs/687951
For more details, see:
https://code.launchpad.net/~stub/launchpad/trivial/+merge/45227
Address the immediate issue of Bug #687951 by installing the database teardown code as an atexit handler. This ensures that not only do we cope with the reproducible case of hitting Ctrl-C at the right time, but other cases where the test suite aborts unexpectedly. This should fix the problem seen on buildbot, unless the test suite aborts are from something much more spectacular such as OOM.
--
https://code.launchpad.net/~stub/launchpad/trivial/+merge/45227
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/trivial into lp:launchpad.
=== modified file 'lib/canonical/ftests/pgsql.py'
--- lib/canonical/ftests/pgsql.py 2010-11-27 21:44:04 +0000
+++ lib/canonical/ftests/pgsql.py 2011-01-05 11:29:58 +0000
@@ -7,6 +7,7 @@
__metaclass__ = type
+import atexit
import os
import random
import time
@@ -267,6 +268,10 @@
"CREATE DATABASE %s TEMPLATE=%s "
"ENCODING='UNICODE'" % (
self.dbname, self.template))
+ # Try to ensure our cleanup gets invoked, even in
+ # the face of adversity such as the test suite
+ # aborting badly.
+ atexit.register(self.dropDb)
break
except psycopg2.DatabaseError, x:
if counter == attempts - 1: