python
config_error
ai_generated
true
pytest未知标记警告:未知的pytest.mark.slow - 是不是拼写错误?
PytestUnknownMarkWarning: Unknown pytest.mark.slow - is this a typo?
ID: python/pytest-markers-unknown
80%修复率
85%置信度
0证据数
2025-04-18首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
根因分析
pytest标记未在配置中注册,导致警告。
English
使用了未注册的pytest标记,导致警告,可能影响测试筛选。
解决方案
-
100% 成功率
[pytest] markers = slow: marks tests as slow -
95% 成功率
def pytest_configure(config): config.addinivalue_line('markers', 'slow: slow tests')
无效尝试
常见但无效的做法:
-
60% 失败
可能导致标记不生效,测试筛选失败。
-
70% 失败
可能移除需要的测试分类。