Skip to content

test: [optional]-dependency tests have no skip guards — a recurring false "pre-existing failure on main" #1511

Description

@Jammy2211

The finding

test_autofit/non_linear/search/nest/test_nautilus.py::test__single_core_builds_no_pool
runs a real search.fit, which reaches from nautilus import Sampler
(autofit/non_linear/search/nest/nautilus/search.py:238). nautilus-sampler==1.0.5
ships only in the [optional] extra (pyproject.toml:85), and the test carries
no skip guard.

CI installs [optional] (PyAutoHeart's lib-tests.ymlpip install "./$r[optional]"),
so CI never sees it. Every env installed without those extras — cloud sandboxes, local
venvs — gets a hard ModuleNotFoundError.

It is the only optional-sampler test in the suite without a guard. Precedent exists
throughout: test_blackjax_nuts.py:14, nest/nss/test_search.py:20,
test_arithmetic_jax_trace.py:6, test_fork_context.py:31.

astropy produces the same class of noise: two modules fail collection on its
top-level import, and nine aggregator tests error on it at runtime
(autofit/aggregator/file_output.py:101, summary/aggregate_fits.py:105,165).

Why it matters

This one test has been reported as "pre-existing on clean main" in at least six
PyAutoMind completion records since 2026-08-16, each costing a control run to
re-disprove. complete/2026/08/prior-support-clipper.md:218 already issued the
correction ("read it as environment-specific"), but the looser phrasing propagated
into later PR bodies (#1479, #1480) and records anyway.

Main is not red. Latest main CI
(run 32546158666):
2024 passed, 3 skipped, 0 failed on 3.12, 3.13 and the no-jax leg.

Reproduced on untouched main @ a639226 (py3.12)

env result
no nautilus-sampler 1 failed, 3 passedModuleNotFoundError at search.py:242
pip install nautilus-sampler==1.0.5, same tree 4 passed
full suite, no optional extras 2 collection errors → then 4 failed / 9 errors, all missing-astropy

The fix

Skip-if-missing guards in the existing house pattern — an
importlib.util.find_spec skipif marker, or pytest.importorskip where the import
is module-level. Inert wherever the extras are installed, so no CI coverage changes.

Prior art: this was filed as follow-up 4 of
PyAutoMind/complete/2026/08/uniform-prior-bounds-numpy-path.md ("hygiene candidate:
skip-if-missing markers") but was never turned into a prompt, so nothing acted on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions