python
config_error
ai_generated
true
PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a typo? You can register custom marks to avoid this warning.
ID: python/pytest-mark-unknown
80%Fix Rate
90%Confidence
0Evidence
2024-03-19First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
Root Cause
A custom marker such as @pytest.mark.slow is used without being registered in pytest.ini, pyproject.toml, or conftest.py, so pytest treats it as a typo.
generic中文
使用了如 @pytest.mark.slow 的自定义标记,但未在 pytest.ini、pyproject.toml 或 conftest.py 中注册,pytest 将其视为拼写错误。
Workarounds
-
98% success
# pytest.ini [pytest] markers = slow: marks tests as slow integration: needs external services -
98% success
# pyproject.toml [tool.pytest.ini_options] markers = [ 'slow: marks tests as slow', ]
Dead Ends
Common approaches that don't work:
-
70% fail
Silences the warning but --strict-markers will still fail the run, and the marker remains unregistered.
-
80% fail
Changes test semantics; skip is not the same as a user-defined tag used for selection.