Skip to content
Latchkey

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 option

Common 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 tests

Fix 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-markers on so typos fail fast.
  • Document what each marker selects for the team.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →