v1.108.293 - Ten skipped modules that hid 209 tests
Ten skipped modules that hid 209 tests between them
Test-only. Nothing user-facing moves.
Every module-scope pytest.importorskip in the suite is now importlib.util.find_spec. importorskip raises during import, so a whole file collapses to a single 1 skipped line however many tests it holds.
Nothing was being lost, and that is the reason to fix it. Every optional package happens to be installed on the dev box and in CI. A CI image that quietly stopped installing watchfiles would have reported a clean run 49 tests short, and N passed cannot show that. Behind the ten guards sat 209 tests: watchfiles 105, yaml 51, starlette 44, tiktoken 9.
Three of the ten sat partway down their file, so the import abort also took out tests defined above the guard that never touched the missing package. Measured with the dependency actually removed:
| file | before | now |
|---|---|---|
test_dbt_provider.py (no yaml) |
1 skipped | 15 passed, 16 skipped |
test_provider_metadata_and_perf.py (no yaml) |
1 skipped | 16 passed, 4 skipped |
test_v1_108_95.py (no starlette) |
1 skipped | 3 passed, 9 skipped |
Imports that genuinely need the package moved under an if _HAS_X: flag. Without that they raise ImportError and a clean skip becomes a collection error. Collection counts are unchanged with the packages present, and all ten files have identical lint findings before and after.
How it was found
In the sibling repo first, the expensive way. jdatamunch's test_excel_parser.py reported one skip while holding 29 tests, 19 of which passed on an ordinary dev box and had never run. It surfaced only by comparing suite totals across two interpreters, 819 against 839 — never from a passed count. An absent module looks like nothing at all in N passed.
tests/test_optional_dep_skips_are_visible.py bans the pattern and separately asserts the heaviest files still collect real items, so a rewrite that hides them another way fails too. Verified by restoring an old guard. Inside a fixture or a test body, importorskip stays correct and visible.
Tests: 8163 passed, 17 skipped, 0 failed on 3.10 and 3.13 — same 8180 total, same skip split. ruff check src/ clean.
pip install --upgrade jcodemunch-mcp