python
runtime_error
ai_generated
true
unittest.case._UnexpectedSuccess: test_something
ID: python/unittest-expected-failure-unexpected-success
80%Fix Rate
90%Confidence
0Evidence
2024-09-25First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
A test marked with `@unittest.expectedFailure` passed, meaning the known bug is fixed or the test no longer fails as expected.
generic中文
标记为 `@unittest.expectedFailure` 的测试通过了,意味着已知 bug 已修复或测试不再按预期失败。
Workarounds
-
95% success
Remove `@unittest.expectedFailure` and run the test; it should pass.
-
90% success
@unittest.skipIf(sys.version_info < (3, 10), 'requires 3.10') def test_something(): ...
Dead Ends
Common approaches that don't work:
-
50% fail
If the bug reappears, the test will fail and may be ignored.
-
70% fail
Hides the fact that the bug is fixed; the test never runs.