- pyproject.toml con FastAPI, SQLAlchemy 2.x, Alembic, Pydantic v2, openpyxl, rapidfuzz, Faker; dev: pytest, httpx, ruff - app/: config desde entorno, engine SQLite con WAL y sesión sin borrado físico, stubs por fase - seed/ y tests/fixtures/ con README; .gitignore excluye *.xlsx fuera de seed/ y tests/fixtures/ - test de /api/health con cliente de prueba y SQLite en memoria
20 lines
499 B
Python
20 lines
499 B
Python
"""Fixtures comunes: app con cliente de prueba y SQLite en memoria."""
|
|
|
|
import os
|
|
from collections.abc import Iterator
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
# Las settings se leen antes de importar la app; en tests nunca se toca ./data.
|
|
os.environ.setdefault("DATABASE_URL", "sqlite://")
|
|
os.environ.setdefault("SECRET_KEY", "secreto-de-pruebas")
|
|
|
|
|
|
@pytest.fixture
|
|
def client() -> Iterator[TestClient]:
|
|
from app.main import app
|
|
|
|
with TestClient(app) as c:
|
|
yield c
|