python
type_error
ai_generated
true
TypeError: skip() missing required positional argument: 'reason'
ID: python/unittest-skip-decorator-syntax
80%Fix Rate
88%Confidence
0Evidence
2026-03-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.9 | active | — | — | — |
Root Cause
Using @unittest.skip without providing a reason string, or using it as a bare decorator without parentheses, causing a TypeError.
generic中文
使用 @unittest.skip 时未提供原因字符串,或将其作为无括号的裸装饰器使用,导致 TypeError。
Workarounds
-
95% success
Use @unittest.skip('reason') with a string argument, e.g., @unittest.skip('Not implemented yet') -
90% success
Alternatively, use @unittest.skipIf(condition, 'reason') to skip conditionally.
Dead Ends
Common approaches that don't work:
-
70% fail
Adding parentheses but no argument (e.g., @unittest.skip()) still fails because reason is required.
-
60% fail
Using @unittest.skipIf(condition) without a reason also fails because reason is required for skipIf.