Saltar a contenido

Testing

Comandos

pytest                                  # Todos
pytest -x                               # Stop on first failure
pytest -k "test_create"                # Por nombre
pytest tests/unit/core/ --tb=short     # Solo core
pytest -m "not slow"                   # Excluir OCR/NER lentos
pytest --cov=src --cov-report=html     # Coverage
pytest tests/integration/ -vvs --pdb   # Debug interactivo

Markers

pytest -m "not slow"         # Excluir OCR/NER lentos
pytest -m integration        # Solo con BD
pytest -m e2e               # Flujo completo (playwright)

Estructura

tests/
├── unit/           # Tests aislados (core, application, infrastructure)
├── integration/    # Tests entre capas
├── e2e/            # Flujo completo (playwright)
├── fixtures/       # Datos de test
└── conftest.py     # Fixtures pytest globales

Pre-commit (quality gate obligatorio)

ruff check src/ && mypy src/ && pytest tests/unit/ -x

Métricas actuales

  • 934 tests pasando (unit + e2e + security)
  • 85% coverage

  • 19 tests de seguridad
  • E2E con playwright (29/32 estables)

Ver TESTING_GUIDE.md para estrategia detallada.