python
config_error
ai_generated
true
已跳过: 未给出原因
Skipped: no reason given
ID: python/pytest-skip-missing-reason
80%修复率
90%置信度
0证据数
2024-01-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
根因分析
使用 @pytest.mark.skip 或 pytest.skip() 跳过了测试,但没有提供原因字符串。这是一个警告,不是错误,但可能会造成混淆。
English
A test was skipped using @pytest.mark.skip or pytest.skip() without providing a reason string. This is a warning, not an error, but can be confusing.
解决方案
-
98% 成功率
@pytest.mark.skip(reason='not implemented yet') def test_feature(): ...
-
95% 成功率
def test_feature(): if not condition: pytest.skip('condition not met')
无效尝试
常见但无效的做法:
-
90% 失败
The test may be intentionally skipped for a valid reason.
-
80% 失败
xfail is for expected failures, not for skipping.