diff --git a/README.md b/README.md index 87ea364..88aca9d 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,23 @@ uv run pytest --cov src/backend uv run pytest src/frontend/flask_app/tests/ ``` +Il modulo di visione (`src/vision/`) è un albero a parte, con un vincolo di +versione diverso dal resto del monorepo: le librerie di VisionSuite da cui +dipende richiedono Python 3.13 o superiore, mentre backend e frontend restano +su Python 3.11. Per questo motivo l'esecuzione di `uv run pytest` con +l'interprete di default mostra i test di `src/vision/tests/` come *skipped*, +non come falliti: il pacchetto viene rilevato ma la sua esecuzione reale +richiede un ambiente Python 3.13 dedicato, creato con il proprio extra `uv`. +Per eseguirli davvero: + +```bash +# Prepara l'ambiente Python 3.13 con le dipendenze di visione +uv sync --extra vision --extra dev --python 3.13 + +# Esegue i test del runner di visione in quell'ambiente +uv run --python 3.13 --extra vision --extra dev pytest src/vision/tests +``` + Stato corrente su `V3.0.0`: **360 pass, 0 fail** (212 backend + 148 frontend). Alcuni test frontend non renderizzano niente e leggono i sorgenti, perché guardano diff --git a/pyproject.toml b/pyproject.toml index 8f8e644..02d5ff9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,4 +87,4 @@ vs-pm2d = { path = "vendor/visionsuite/packages/vs-pm2d", editable = true } [tool.pytest.ini_options] asyncio_mode = "auto" -testpaths = ["src/backend/tests", "src/frontend/flask_app/tests"] +testpaths = ["src/backend/tests", "src/frontend/flask_app/tests", "src/vision/tests"] diff --git a/src/vision/tests/test_runner.py b/src/vision/tests/test_runner.py index c8536ea..129b528 100644 --- a/src/vision/tests/test_runner.py +++ b/src/vision/tests/test_runner.py @@ -1,7 +1,23 @@ """Il runner: grafo più immagine, numeri fuori. Niente HTTP, niente database.""" -import numpy as np import pytest +# The vision tree requires Python >=3.13 (vs-task/vs-measure/vs-pm2d declare it +# upstream, see pyproject.toml's `vision` extra), while backend and frontend +# stay on 3.11. This must run before `import numpy` - numpy itself is only +# installed alongside the vision extra - so that `uv run pytest` on the +# default 3.11 environment reports this module as skipped, with a reason, +# instead of erroring out of the whole collection. +pytest.importorskip( + "visionsuite.task", + reason=( + "the vision tree requires Python >=3.13 (vs-task/vs-measure/vs-pm2d " + "declare it upstream); run it with " + "`uv run --python 3.13 --extra vision --extra dev pytest src/vision/tests`" + ), +) + +import numpy as np + from src.vision.runner import RunOutcome, engine_version, run_graph