python
runtime_error
ai_generated
true
AssertionError: Test should have been skipped but was not
ID: python/unittest-skipif-condition-evaluated-false
80%Fix Rate
83%Confidence
0Evidence
2025-11-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The skipIf condition is incorrectly evaluated, causing the test to run when it should be skipped.
generic中文
skipIf 条件被错误评估,导致测试在应被跳过时运行。
Workarounds
-
95% success
@unittest.skipIf(condition, 'reason') def test_foo(self): ... -
90% success
@pytest.mark.skipif(condition, reason='reason')
Dead Ends
Common approaches that don't work:
-
60% fail
This might skip the test when it should run.
-
90% fail
The test will always run, defeating the purpose.