Skip to content

test(ci): fail the run on skips caused by a missing module - #55

Merged
larsrollik merged 1 commit into
mainfrom
ci/fail-on-import-skips
Nov 26, 2026
Merged

larsrollik merged 1 commit into
mainfrom
ci/fail-on-import-skips

Conversation

@larsrollik

Copy link
Copy Markdown
Member

Goal

Tests that skip when an optional import is missing turned a broken install into a green run.

Changes

  • add --fail-on-import-skips and --allow-import-skip=<module> to the test conftest: a skip whose reason says a module is missing or could not be imported fails the session unless it names an allowed module
  • the guard is one self-contained block in tests/conftest.py, so another repo can copy it
  • run the CI test job with the guard and an allow-list of the optional camera backends it does not install
  • add tests for the guard (off by default, fails on an import skip, allow-list, platform skip untouched)

Impact

CI fails on an unexpected import skip; platform and fixture skips are unchanged.

References

Closes: #54

Goal: Tests that skip when an optional import is missing turned a broken install
into a green run.

Changes:
- add `--fail-on-import-skips` and `--allow-import-skip=<module>` to the test
  conftest: a skip whose reason says a module is missing or could not be
  imported fails the session unless it names an allowed module
- the guard is one self-contained block in `tests/conftest.py`, so another
  repo can copy it
- run the CI test job with the guard and an allow-list of the optional camera
  backends it does not install
- add tests for the guard (off by default, fails on an import skip,
  allow-list, platform skip untouched)

References:

Closes: #54
@larsrollik
larsrollik requested a review from a team as a code owner November 25, 2026 23:21
@larsrollik
larsrollik merged commit 9ee24a2 into main Nov 26, 2026
7 checks passed
@larsrollik
larsrollik deleted the ci/fail-on-import-skips branch November 26, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests skip silently when an optional package is missing

1 participant