Skip to content

Commit

Permalink
fix "InvalidOperation: Cannot use MongoClient after close" in test_db
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Sep 19, 2024
1 parent 72fb6fb commit cfec5e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions st2common/tests/unit/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ def tearDown(self):
disconnect()
cfg.CONF.reset()

@classmethod
def tearDownClass(cls):
# since tearDown discconnects, dropping the database in tearDownClass
# fails withotu establishing a new connection.
cls._establish_connection_and_re_create_db()
super().tearDownClass()

def test_check_connect(self):
"""
Tests connectivity to the db server. Requires the db server to be
Expand Down

0 comments on commit cfec5e0

Please sign in to comment.