fix: punkt 2 (test-DB) — clean_tables fixture fixed (exclude alembic_version/unified_search, 30s lock_timeout), 8/8 contact tests pass in 15.8s

This commit is contained in:
Agent Zero
2026-08-20 13:26:49 +02:00
parent e30da26722
commit 03b386e82c
+5 -3
View File
@@ -218,7 +218,7 @@ def db_setup():
sync_eng.dispose()
@pytest.fixture(autouse=False)
@pytest.fixture(autouse=True)
def clean_tables(db_setup):
"""Clean all table data before each test (preserve schema).
@@ -228,11 +228,13 @@ def clean_tables(db_setup):
"""
sync_eng = _get_sync_engine()
with sync_eng.connect() as conn:
# Query existing table names from information_schema
conn.execute(text("SET lock_timeout = '30s';"))
# Query existing table names, exclude problematic tables
result = conn.execute(
text(
"SELECT table_name FROM information_schema.tables "
"WHERE table_schema = 'public' AND table_type = 'BASE TABLE';"
"WHERE table_schema = 'public' AND table_type = 'BASE TABLE' "
"AND table_name NOT IN ('alembic_version', 'unified_search_index_log', 'unified_search_providers')"
)
)
existing_tables = [row[0] for row in result]