pytest marker not registered (--strict-markers) in CI
With --strict-markers, every @pytest.mark.X must be declared in config. A marker that is only used but never registered becomes a hard error in CI instead of a warning.
What this error means
pytest errors with "'integration' not found in markers configuration option" and fails collection when strict markers are enabled.
pytest
tests/test_db.py:8: in <module>
@pytest.mark.integration
E 'integration' not found in 'markers' configuration optionCommon causes
A custom marker is not declared
You used a marker like integration without registering it in markers, which strict mode forbids.
A typo in the marker name
A misspelled marker is treated as an unknown one and rejected under strict markers.
How to fix it
Register the marker
Declare every custom marker in pytest config so strict mode accepts it.
pytest.ini
[pytest]
markers =
integration: tests that hit external services
slow: long-running testsFix the marker spelling
Correct any typo so it matches a registered marker name.
test_db.py
@pytest.mark.integration
def test_db():
...How to prevent it
- Register every custom marker in
[pytest] markers. - Keep
--strict-markerson so typos fail fast. - Document what each marker selects for the team.
Related guides
pytest exit code 5 (no tests ran) in CIFix pytest exit code 5 in CI - pytest collected no tests and returns 5, which fails the job even though no te…
pytest "fixture not found" in CIFix pytest "fixture 'X' not found" in CI - a test requested a fixture pytest could not locate, usually a conf…
pytest "collected 0 items" in CIFix pytest "collected 0 items" in CI - pytest ran but discovered no tests, usually because of naming, rootdir…