From cb0c9af97b6abfd04163dba2c0d7889d11042c66 Mon Sep 17 00:00:00 2001 From: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com> Date: Thu, 14 May 2026 14:35:34 -0400 Subject: [PATCH] fix: modify conftest to fix ci --- tests/conftest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index c245a1ee..06a31ac8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -321,6 +321,7 @@ async def fake_cache(fake_cache_session: FakeAsyncRedis): async def client( db_session: AsyncSession, fake_cache_session: FakeAsyncRedis, # pyright: ignore[reportUnusedParameter] + monkeypatch: pytest.MonkeyPatch, ) -> AsyncGenerator[TestClient, Any]: """Create a FastAPI TestClient for the scope of a single test function""" @@ -338,6 +339,18 @@ async def client( yield db_session app.dependency_overrides[get_db] = override_get_db + + # No-op the startup embedding-schema validator inside the lifespan. The + # global `engine` it would inspect points to a DB that isn't migrated in + # CI (per-worker test DBs are migrated separately by db_engine), and we + # don't want the validator to dispose the test engine via the lifespan + # finally block either. The validator has its own dedicated coverage in + # tests/startup/test_embedding_validator.py against db_engine directly. + async def _skip_validate(_engine: object) -> None: + return None + + monkeypatch.setattr("src.main.validate_embedding_schema", _skip_validate) + with TestClient(app) as c: if settings.AUTH.USE_AUTH: # give the test client the admin JWT