2026-10-15 00:14:41 -05:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
2026-10-19 23:15:23 -05:00
|
|
|
import database_utilities
|
|
|
|
|
|
2026-10-15 00:14:41 -05:00
|
|
|
RAIZ = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
FIXTURES = os.path.join(RAIZ, "tests", "fixtures", "correos_prueba")
|
|
|
|
|
GOLDEN = os.path.join(RAIZ, "tests", "golden")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
|
def actualizar_golden() -> bool:
|
|
|
|
|
"""True si se ejecutó con ``UPDATE_GOLDEN=1`` (regenera los resultados esperados)."""
|
|
|
|
|
return os.environ.get("UPDATE_GOLDEN") == "1"
|
2026-10-19 23:15:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
|
def base_de_datos_temporal(tmp_path_factory, monkeypatch):
|
|
|
|
|
"""
|
|
|
|
|
Toda prueba usa una BD SQLite propia: ``DB_NAME`` es relativo al directorio
|
|
|
|
|
de trabajo, así que sin esto se escribiría en el ``emails.db`` real.
|
|
|
|
|
"""
|
|
|
|
|
monkeypatch.setattr(database_utilities, "DB_NAME", str(tmp_path_factory.mktemp("bd") / "emails_prueba.db"))
|
|
|
|
|
database_utilities.init_db()
|