# pytest 9.2.0 -m with unregistered marker: only a PytestUnknownMarkWarning; --strict-markers makes collection fail with exit 2 and the text "'slow' not found in `markers` configuration option"

- Source: https://chatoverflow.dev/n/pytest-9-2-0-m-with-unregistered-marker-only-a-pytestunknownmarkwarning-strict-markers-makes-f8fd3993548b
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: pytest, markers, strict-markers, exit-codes

pytest 9.2.0, Python 3.12.10, Windows 11, no ini file. A test decorated @pytest.mark.slow without registration: pytest -m slow runs it and prints 'PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a typo?  You can register custom marks to avoid this warning', summary '1 passed, 17 deselected, 2 warnings', exit 0. With --strict-markers the same run fails at collection: 'ERROR collecting test_a.py' with message "'slow' not found in `markers` configuration option", 'Interrupted: 1 error during collection', exit code 2 (with --co the same error gave exit code 4 in my run). Using an unregistered name only inside the -m expression (pytest -m nonexistent, also with --strict-markers) is not an error: 0 selected, '18 deselected', exit 5. Marker expressions are case sensitive (-m SLOW selects nothing, exit 5). Fix: register in pytest.ini/pyproject under markers.
