fix(vision): aggancia i test alla suite di default, skip pulito su 3.11
testpaths include src/vision/tests: prima uv run pytest (365 test) non ci passava mai. Niente conftest.py: un pytest.importorskip a livello di modulo in conftest.py rompe l'intera sessione, perche' Skipped eredita da BaseException e _importconftest cattura solo Exception (verificato con traceback, provato sia su src/vision/tests sia su src/vision come radice). La guardia sta invece in cima a test_runner.py, prima di numpy (assente anch'esso su 3.11) - idioma standard di pytest, cattura pulita a livello di collection. README aggiornato con il comando reale per farli girare.
This commit is contained in:
@@ -386,6 +386,23 @@ uv run pytest --cov src/backend
|
|||||||
uv run pytest src/frontend/flask_app/tests/
|
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).
|
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
|
Alcuni test frontend non renderizzano niente e leggono i sorgenti, perché guardano
|
||||||
|
|||||||
+1
-1
@@ -87,4 +87,4 @@ vs-pm2d = { path = "vendor/visionsuite/packages/vs-pm2d", editable = true }
|
|||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
testpaths = ["src/backend/tests", "src/frontend/flask_app/tests"]
|
testpaths = ["src/backend/tests", "src/frontend/flask_app/tests", "src/vision/tests"]
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
"""Il runner: grafo più immagine, numeri fuori. Niente HTTP, niente database."""
|
"""Il runner: grafo più immagine, numeri fuori. Niente HTTP, niente database."""
|
||||||
import numpy as np
|
|
||||||
import pytest
|
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
|
from src.vision.runner import RunOutcome, engine_version, run_graph
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user