Tests that importorskip('petab') skip when petab is installed but broken, so a broken petab passes CI as skipped tests

Aperta
#1,031 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Start by reading tests/conftest.py and the seven tutorial test modules updated for #1028, then locate the remaining pytest.importorskip('petab') calls across the 20 test files. Check that tests skip only when petab is absent and fail when an installed petab raises an import error; use the reproduction in the issue to verify the behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

latent bug

153 calls of pytest.importorskip('petab') (or a petab. submodule) in 20 test files skip their tests when petab cannot be imported for any reason. pytest's importorskip turns a ModuleNotFoundError into a skip, and that includes one raised inside petab for a dependency that petab itself is missing. A petab that is installed but broken therefore does not fail any of these tests. They report as skipped, and some skip reasons name the wrong cause.

Reproduction. Put a stand-in petab on the path whose import fails on a missing dependency:

mkdir -p /tmp/fakepetab/petab
echo "import a_dependency_that_is_missing_xyz" > /tmp/fakepetab/petab/__init__.py
PYTHONPATH=/tmp/fakepetab .venv/bin/python -m pytest -o addopts='' -q -rs tests/test_linear_profiling.py tests/test_expression_objective.py

With the real petab 0.9.0 these two modules run 95 tests, all passing. With the broken one, both modules skip as a whole:

SKIPPED [1] tests/test_linear_profiling.py:39: could not import 'petab': No module named 'a_dependency_that_is_missing_xyz'
SKIPPED [1] tests/test_expression_objective.py:32: objective = expression needs the optional pybnf[petab] extra

The second reason says the extra is not installed. It is installed, and broken.

This matters most where petab breaks in an upgrade. petab has no pin beyond >=0.9,<1, and every CI leg except the dependency-floors one installs it, so a petab release that fails to import in PyBNF's environment would turn these suites into skips on every leg, with CI green.

#1028 added a petab marker that tests/conftest.py skips only when petab is absent (importlib.util.find_spec('petab') is None), and module-level skips in seven tutorial test modules that follow the same rule. A petab that is present but broken fails those tests. Converting the remaining importorskip('petab') calls to the marker, or to the same find_spec check, would give every petab test that behaviour.

Lingua principale
Python
Stelle
25
Fork
25
Merge medio
4h 5m
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lanl/PyBNF

Tutte le issue di lanl/PyBNF

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.