From 46787de9bcfd0a0e4314e5008592cf0a43fa928d Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Tue, 24 Nov 2026 16:05:27 +0100 Subject: [PATCH] Use an explicit transaction --- tests/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 36510ed..38eab67 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -54,8 +54,9 @@ def db_connection(request): db.connection = connection if request.param == 'all_at_once': - connection.execute(f'CREATE SCHEMA {config.CLEAN_SCHEMA};') - db.Base.metadata.create_all(connection) + with connection.begin(): + connection.execute(sa.text(f'CREATE SCHEMA {config.CLEAN_SCHEMA};')) + db.Base.metadata.create_all(connection) else: cfg = migrations_config.Config('alembic.ini') migrations_cmd.upgrade(cfg, 'head')