Files
2026-11-13 11:53:48 -06:00

3.0 KiB

Test and run

Moved from AGENTS.md §4 on 2026-11-03.

(cd Core && uv run pytest -q)          # 18 (2 skip)
(cd Persistance && uv run pytest -q)   # 18 (1 skip)
(cd Extraction && uv run pytest -q)    # 83 (OCR tests need tesseract + spa and osd data)
(cd models && uv run pytest -q)        # 180 (real Jupyter kernels and a runner process in tests/pipelines/test_experiment.py)
(cd WebApi && uv sync --extra sql-drivers && uv run pytest -q)   # 497 passed, 7 skipped (MySQL live tests; includes webapi.orquestacion's own suite, test_orquestacion_*.py — folded in from the former standalone Orquestacion/ package, 2026-10-31)
(cd WebApp && npx ng test --watch=false && npx ng build)        # 1248 (a few specs, mostly indicadores, time out under heavy load; pass alone)

If a package's .venv has stale absolute paths baked into its entry-point scripts (symptom: uv run pytest silently runs under a different interpreter than uv run python, with ModuleNotFoundError for packages that are clearly installed) after moving the repo on disk, rm -rf <pkg>/.venv && (cd <pkg> && uv sync) rebuilds it fresh at the correct path.

Local dev: WebApi uv run python main.py (port 5050; macOS needs OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES for gunicorn), WebApp npx ng serve (proxy in WebApp/proxy.conf.json). Docker: docker compose up --build; .env (from .env.example) points the DB URLs elsewhere. ../e2e/README.md documents the MySQL test container (isssteleon-mysql-test, port 3307) and the scripted run ../e2e/api_e2e.py.

Live checks done 2026-10-19 with Docker + MySQL 8 + SQL Server 2022 (isssteleon-mssql-test, port 1433): all migrations, LONGBLOB columns, SQL Server connector (browse, preview, SELECT-only policy, commit), document extraction across typed + scanned PDFs, EEG commit with the file stored, OCR job, model-version lifecycle. All passed.

Why each test exists (rule 11)

A reader who sees a test fail must be able to tell, from the test alone, whether the change or the test is wrong. So every test module, fixture and test documents itself:

"""What this module covers: `TimelineRepository` reading the silver timeline.

Fixtures: `session_factory`, an in-memory SQLite table with three events of two patients.
"""


@pytest.fixture
def session_factory():
    """Three events: patient 1 (a cytology and a biopsy), patient 2 (a cytology loaded later)."""


def test_a_query_with_other_columns_breaks_the_contract(session_factory):
    """Pins down: `read` refuses a query whose columns aren't `TIMELINE_COLUMNS`.

    Fails if `read` stops checking the columns, or if `TIMELINE_COLUMNS` changes without the queries.
    """
  • Module: what it covers and which fixtures it uses.
  • Fixture: what data it sets up, in terms a reader can check against the assertions.
  • Test: what behaviour it pins down, and which change would make it fail.
  • Rule 12 applies: no issue numbers, plans or decisions from WorkingNarrative in tests of the deliverable tree.