Skip to content

Commit b6e1fe0

Browse files
committed
Cleanup db on start.
If you ^C a test, the db doesn't get cleaned up properly. This results in errors when running a test manually. Add a class method to postgresqlOpener. setup_class runs once when the class is initialized.
1 parent 976e4b4 commit b6e1fe0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_postgresql.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ class postgresqlOpener:
4747
if have_backend('postgresql'):
4848
module = get_backend('postgresql')
4949

50+
def setup_class(cls):
51+
# nuke the db once for the class. Handles the case
52+
# where an aborted test run (^C during setUp for example)
53+
# leaves the database in an unusable, partly configured state.
54+
try:
55+
cls.nuke_database(cls)
56+
except:
57+
# ignore failure to nuke the database.
58+
pass
59+
5060
def setUp(self):
5161
pass
5262

0 commit comments

Comments
 (0)