Component
Python SDK
Infrahub SDK version
1.23.0b1
Current Behavior
The pytest plugin registers the marker under the wrong name. In pytest_plugin/plugin.py we
register infrahub_integraton, with a missing i:
config.addinivalue_line(
"markers",
"infrahub_integraton: Integation test for an Infrahub resource, depends on an Infrahub running instance",
)
But pytest_plugin/loader.py applies pytest.mark.infrahub_integration, the correct name. So the
marker we really use is never registered, and the one we register is never used. The description
text has the same kind of typo, Integation instead of Integration.
Two effects:
- With the default settings, every integration test raises
PytestUnknownMarkWarning: Unknown pytest.mark.infrahub_integration - is this a typo?. A user who runs with filterwarnings = error
turns this into a failure.
- With
--strict-markers, collection fails with 'infrahub_integration' not found in markers configuration option.
pytest --markers also lists a marker that does not exist in practice, which is confusing for
anyone who wants to select tests by marker.
Expected Behavior
The marker we apply is the marker we register. No warning on a default run, and no error under
--strict-markers.
Steps to Reproduce
- Install the SDK
- Write a test file with
@pytest.mark.infrahub_integration
- Run
pytest --strict-markers, collection fails
- Run
pytest without the flag, a PytestUnknownMarkWarning is raised
- Run
pytest --markers and see infrahub_integraton in the list
Additional Information
Fix is to rename the registered marker to infrahub_integration and correct the description. Adding
--strict-markers to our own test settings would stop this from happening again.
Component
Python SDK
Infrahub SDK version
1.23.0b1
Current Behavior
The pytest plugin registers the marker under the wrong name. In
pytest_plugin/plugin.pyweregister
infrahub_integraton, with a missingi:But
pytest_plugin/loader.pyappliespytest.mark.infrahub_integration, the correct name. So themarker we really use is never registered, and the one we register is never used. The description
text has the same kind of typo,
Integationinstead ofIntegration.Two effects:
PytestUnknownMarkWarning: Unknown pytest.mark.infrahub_integration - is this a typo?. A user who runs withfilterwarnings = errorturns this into a failure.
--strict-markers, collection fails with'infrahub_integration' not found in markers configuration option.pytest --markersalso lists a marker that does not exist in practice, which is confusing foranyone who wants to select tests by marker.
Expected Behavior
The marker we apply is the marker we register. No warning on a default run, and no error under
--strict-markers.Steps to Reproduce
@pytest.mark.infrahub_integrationpytest --strict-markers, collection failspytestwithout the flag, aPytestUnknownMarkWarningis raisedpytest --markersand seeinfrahub_integratonin the listAdditional Information
Fix is to rename the registered marker to
infrahub_integrationand correct the description. Adding--strict-markersto our own test settings would stop this from happening again.