python
config_error
ai_generated
true
PytestUnknownMarkWarning: 未知的 pytest.mark.slow - 是拼写错误吗?你可以使用 markers 选项注册它
PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a typo? You can register it with markers option
ID: python/pytest-marker-unknown
80%修复率
85%置信度
0证据数
2024-12-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
测试中使用了自定义标记,但未在 pytest 配置中注册,导致收集期间出现警告。
English
A custom marker is used in tests but not registered in pytest configuration, causing a warning during collection.
解决方案
-
95% 成功率
Register the marker in pytest.ini: `[pytest] markers = slow: marks tests as slow` -
90% 成功率
Use `pytest --markers` to list all registered markers and ensure the custom one is defined.
无效尝试
常见但无效的做法:
-
80% 失败
This removes useful metadata for test selection and organization.
-
60% 失败
The warning may escalate to an error in future pytest versions, and it hides potential typos.