python
type_error
ai_generated
true
类型错误:skip() 恰好接受一个参数(给定 0 个)
TypeError: skip() takes exactly one argument (0 given)
ID: python/unittest-skip-decorator-not-working
80%修复率
88%置信度
0证据数
2024-11-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
使用 @unittest.skip 而没有提供原因字符串。
English
Using @unittest.skip without a reason string.
解决方案
-
99% 成功率
@unittest.skip('reason for skipping') def test_foo(self): ... -
98% 成功率
@pytest.mark.skip(reason='reason for skipping')
无效尝试
常见但无效的做法:
-
90% 失败
skip is a function that requires a reason argument.
-
80% 失败
skipIf requires two arguments: condition and reason.