Mercurial > p > roundup > code
diff test/test_postgresql.py @ 6622:2a3bd715bbeb
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.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 05 Mar 2022 19:28:12 -0500 |
| parents | 3f13ddd98e5c |
| children | 09d9c646ca89 |
line wrap: on
line diff
--- a/test/test_postgresql.py Sat Mar 05 19:04:50 2022 -0500 +++ b/test/test_postgresql.py Sat Mar 05 19:28:12 2022 -0500 @@ -47,6 +47,16 @@ if have_backend('postgresql'): module = get_backend('postgresql') + def setup_class(cls): + # nuke the db once for the class. Handles the case + # where an aborted test run (^C during setUp for example) + # leaves the database in an unusable, partly configured state. + try: + cls.nuke_database(cls) + except: + # ignore failure to nuke the database. + pass + def setUp(self): pass
