"""Shared test fixtures for Waxwing.""" from __future__ import annotations import tempfile from pathlib import Path import pytest from fastapi.testclient import TestClient from app.db.store import Store @pytest.fixture def tmp_db(tmp_path: Path) -> Path: """Return a path to a fresh, migration-applied SQLite database.""" db_path = tmp_path / "test.db" s = Store(db_path) s.close() return db_path @pytest.fixture def store(tmp_db: Path) -> Store: s = Store(tmp_db) yield s s.close() @pytest.fixture def client(tmp_db: Path, monkeypatch) -> TestClient: """TestClient with a temp database injected via settings.""" from app.core import config as cfg_module monkeypatch.setattr(cfg_module.settings, "DB_PATH", tmp_db) from app.main import app return TestClient(app)