comparison 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
comparison
equal deleted inserted replaced
6621:6f35be77324c 6622:2a3bd715bbeb
45 @skip_postgresql 45 @skip_postgresql
46 class postgresqlOpener: 46 class postgresqlOpener:
47 if have_backend('postgresql'): 47 if have_backend('postgresql'):
48 module = get_backend('postgresql') 48 module = get_backend('postgresql')
49 49
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
50 def setUp(self): 60 def setUp(self):
51 pass 61 pass
52 62
53 def tearDown(self): 63 def tearDown(self):
54 self.nuke_database() 64 self.nuke_database()

Roundup Issue Tracker: http://roundup-tracker.org/