Skip to content

Commit

Permalink
Don't error when trying to remove a DB that's already gone.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed May 12, 2021
1 parent f506d04 commit 59fd472
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions kolibri/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ def teardown_database():
from kolibri.core.tasks.main import connection

connection.dispose()

with django_db_blocker.unblock():
teardown_databases(
db_cfg,
verbosity=pytest.config.option.verbose,
)
try:
teardown_databases(
db_cfg,
verbosity=pytest.config.option.verbose,
)
except Exception as exc:
request.node.warn(
pytest.PytestWarning(
"Error when trying to teardown test databases: %r" % exc
)
)

if not django_db_keepdb:
request.addfinalizer(teardown_database)
Expand Down

0 comments on commit 59fd472

Please sign in to comment.