-
-
Save rightfold/dd69942ecd51bec2e191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseTestCase(unittest.TestCase): | |
def setUp(self): | |
self.tx = postgresql.db.begin() | |
postgresql.db = self.tx | |
for store in postgresql.__dict__.values(): | |
for attempt in ['_PostgreSQLStore__db', '_db', 'db']: | |
if hasattr(store, attempt): | |
setattr(store, attempt, self.tx) | |
break | |
store._PostgreSQLStore__tl = threading.local() | |
def tearDown(self): | |
self.tx.__exit__(Exception, Exception(), None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment