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-marker-unknown-warning
80%Fix Rate
88%Confidence
0Evidence
2025-07-08First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
Root Cause
A custom marker is used without being registered in pytest.ini/pyproject.toml; pytest emits a warning, and with `-W error` it becomes a failure.
generic中文
使用了未在 pytest.ini/pyproject.toml 注册的自定义标记;pytest 发出警告,在 `-W error` 下变为失败。
Workarounds
-
98% success
# pyproject.toml [tool.pytest.ini_options] markers = [ "slow: marks tests as slow", "integration: requires external services", ] # then pytest -m slow
-
90% success
# pyproject.toml [tool.pytest.ini_options] addopts = "--strict-markers" markers = ["slow: slow tests"]
Dead Ends
Common approaches that don't work:
-
90% fail
Changes test semantics (skips instead of conditionally selecting) and loses filtering capability.
-
70% fail
Hides typos in marker names and prevents `--strict-markers` from catching regressions.
-
95% fail
Suppresses all warnings, including real deprecations and correctness issues.