From 94d295b366420d9b227a6192d66e73ee4c16718b Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sun, 8 Jun 2025 00:54:58 +0200 Subject: close SQL connections in tests Otherwise Postgres does not let us drop the tables and hangs forever --- tests/conftest.py | 1 + tests/playwright/conftest.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/conftest.py b/tests/conftest.py index cd74b0b..652d443 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -52,6 +52,7 @@ def dbengine(app_settings, ini_file): yield engine + engine.dispose() Base.metadata.drop_all(bind=engine) alembic.command.stamp(alembic_cfg, None, purge=True) diff --git a/tests/playwright/conftest.py b/tests/playwright/conftest.py index e914b01..adf5ef3 100644 --- a/tests/playwright/conftest.py +++ b/tests/playwright/conftest.py @@ -57,7 +57,11 @@ def dbaccess(app): through and the running WSGI app cannot read them. """ session_factory = app.registry["dbsession_factory"] - return session_factory() + factory = session_factory() + + yield factory + + factory.close() class Helper: -- cgit v1.2.3