Skip to content

fix: register the infrahub_integration pytest marker under its real name - #1233

Open
gmazoyer wants to merge 2 commits into
stablefrom
gma-pytest-integration-marker-name
Open

fix: register the infrahub_integration pytest marker under its real name#1233
gmazoyer wants to merge 2 commits into
stablefrom
gma-pytest-integration-marker-name

Conversation

@gmazoyer

@gmazoyer gmazoyer commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #1231

The pytest plugin registered infrahub_integraton, with a missing i, but the loader applies infrahub_integration. So the marker we really use was never registered, and the one we registered was never used. The description had the same kind of typo, Integation.

Two things this fixes for users:

  • Integration tests no longer raise PytestUnknownMarkWarning on a normal run. A user running with filterwarnings = error was turning that warning into a failure.
  • Collection no longer fails under --strict-markers with 'infrahub_integration' not found in markers configuration option.

pytest --markers also stops listing a marker that nothing applies.

Guard against a repeat

I turned on --strict-markers for our own test run. An unregistered marker now fails the build instead of passing with a warning nobody reads. I checked it is safe, the full suite still collects with no marker error.

The new test collects a smoke, a unit and an integration item with --strict-markers on. It fails on the old code with the exact error above.

Test

  • tests/unit/pytest_plugin/: 9 passed
  • tests/unit/: 4 failures, all present on stable without this change (test_repo_list, test_repo_init, test_task_list_command, test_gitrepo_init)
  • invoke format lint-code: clean

Summary by cubic

Register the infrahub_integration pytest marker under its correct name to stop UnknownMark warnings and strict collection failures. Also enable --strict-markers and add tests to prevent regressions, including resource marker coverage.

  • Bug Fixes

    • Register infrahub_integration correctly and fix the marker description typo.
    • Eliminate PytestUnknownMarkWarning and failures under --strict-markers; pytest --markers no longer lists an unused marker.
  • Refactors

    • Enable --strict-markers in test configuration to catch unregistered markers early.
    • Add tests: verify smoke/unit/integration items collect with --strict-markers, and check all resource markers from MARKER_MAPPING are registered via pytest --markers.

Written for commit ec8ae22. Summary will update on new commits.

Review in cubic

The marker was registered as `infrahub_integraton`, with a missing `i`, but
the loader applies `infrahub_integration`. So the marker we use was never
registered and the one we register was never used.

Every integration test raised a `PytestUnknownMarkWarning`, and collection
failed under `--strict-markers`. `pytest --markers` also listed a marker that
nothing applies, which is misleading for anyone selecting tests by marker.

Turn on `--strict-markers` for our own test run so an unregistered marker
fails the build instead of passing silently.
@gmazoyer
gmazoyer requested a review from a team as a code owner August 7, 2026 16:37
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: ec8ae22
Status: ✅  Deploy successful!
Preview URL: https://df62d6f1.infrahub-sdk-python.pages.dev
Branch Preview URL: https://gma-pytest-integration-marke.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           stable    #1233      +/-   ##
==========================================
+ Coverage   82.47%   82.54%   +0.06%     
==========================================
  Files         138      138              
  Lines       12186    12186              
  Branches     1833     1833              
==========================================
+ Hits        10051    10059       +8     
+ Misses       1572     1568       -4     
+ Partials      563      559       -4     
Flag Coverage Δ
integration-tests 40.57% <ø> (+<0.01%) ⬆️
python-3.10 56.32% <ø> (+0.04%) ⬆️
python-3.11 56.32% <ø> (+0.04%) ⬆️
python-3.12 56.34% <ø> (+0.06%) ⬆️
python-3.13 56.32% <ø> (+0.06%) ⬆️
python-3.14 56.34% <ø> (+0.08%) ⬆️
python-filler-3.12 22.27% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/pytest_plugin/plugin.py 84.78% <ø> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/unit/pytest_plugin/test_plugin.py Outdated
The first test only collected Jinja2Transform items, so a typo in the check,
graphql query or python transform marker went unnoticed. Collecting the other
resource kinds does not help either. `MARKER_MAPPING` is built when the loader
is imported, so those marks exist before a config is attached, and
`MarkGenerator` only validates a mark when it has one.

Compare them against the registered list instead, and keep the collection test
for the markers that are applied while collecting. The expected names come from
`MARKER_MAPPING`, so a new resource marker is covered on its own.
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.

bug: pytest plugin registers infrahub_integraton instead of infrahub_integration

1 participant