# tests/conftest.py import os import sys import pytest # Add the project root to sys.path so "import app" works PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, PROJECT_ROOT) from app.main import app from fastapi.testclient import TestClient # adjust if you use a different test client @pytest.fixture(scope="session") def test_client(): """ Shared test client for hitting the web app. Assumes your DATABASE_URL / env vars are already pointing at a TEST database, not your real Neon instance. """ # Optionally override env vars here, e.g.: # os.environ["DATABASE_URL"] = "postgresql+psycopg://user:pass@host/test_db" client = TestClient(app) yield client