python
type_error
ai_generated
true
TypeError: skipif() got an unexpected keyword argument 'condition'
ID: python/pytest-mark-skipif-condition-error
80%Fix Rate
90%Confidence
0Evidence
2025-05-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.4.0 | active | — | — | — |
Root Cause
错误地使用了 pytest.mark.skipif,将其作为函数调用而非装饰器。
generic中文
错误地使用了 pytest.mark.skipif,将其作为函数调用而非装饰器。
Workarounds
-
100% success
`@pytest.mark.skipif(sys.version_info < (3, 8), reason='需要 Python 3.8+')`
-
90% success
在测试函数内 `pytest.skip('原因')` 根据条件跳过。
Dead Ends
Common approaches that don't work:
-
80% fail
skipif 需要条件表达式,移除后无法判断是否跳过。
-
60% fail
skip 是无条件的,不符合需求。