diff --git a/tests/conftest.py b/tests/conftest.py index 92b1db0..53f0c18 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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]