"""Shared pytest fixtures. Uses SQLite for speed (see ARCHITECTURE.md ยง4.8). Any test that needs Postgres-specific behaviour lives in a Postgres-only fixture path (added when a migration or query needs it). """ from __future__ import annotations import os from collections.abc import Iterator import pytest from fastapi.testclient import TestClient @pytest.fixture(scope="session", autouse=True) def _test_env() -> Iterator[None]: """Set minimum env vars required for `Settings()` to construct in tests.""" os.environ.setdefault("DATABASE_URL", "sqlite:///:memory:") os.environ.setdefault("JWT_SECRET", "test-secret") os.environ.setdefault( "COLUMN_ENCRYPTION_KEY", "test-col-enc-key-32bytes-______________" ) os.environ.setdefault("ENV", "test") yield @pytest.fixture def client() -> Iterator[TestClient]: from ypms.main import create_app app = create_app() with TestClient(app) as c: yield c