python
config_error
ai_generated
true
使用错误:提供的标记 'slow' 在测试收集中未找到
UsageError: provided markers not found in collection: ['slow']
ID: python/pytest-marker-expression-error
80%修复率
87%置信度
0证据数
2024-02-14首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.4.0 | active | — | — | — |
根因分析
使用 -m 参数指定标记,但测试中没有定义该标记
English
使用 -m 参数指定标记,但测试中没有定义该标记
解决方案
-
95% 成功率
在 pytest.ini 中添加 markers = slow: 慢速测试
-
80% 成功率
pytest --markers 列出所有可用标记
无效尝试
常见但无效的做法:
-
30% 失败
如果标记未注册,pytest 仍会警告
-
90% 失败
导致没有测试运行