You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unittest may incorrectly return exit code 5 when setUpClass raises an exception #136442
In Python 3.12+, unittest returns exit code 5 when no tests are run and none are skipped. However, if a test class’s setUpClass() method raises any exception (except unittest.SkipTest; related to #106584), no tests are executed, and unittest may incorrectly return exit code 5.
This is misleading: the failure occurred due to an error in class-level setup, not because all tests were skipped.
Activity
ZeroIntensity commentedon Jul 9, 2025
Sounds like a reasonable fix. Would you like to submit a PR?
ueshin commentedon Jul 9, 2025
@ZeroIntensity Sure, I will submit a PR. Thanks!
Merge branch 'main' into pythongh-136442
[SPARK-52739][PYTHON][TEST] Apply a patch to unittest.main to report …
Merge remote-tracking branch 'upstream/main' into pythongh-136442
gh-136442: Fix unittest to return exit code 5 when setUpClass raises …
pythongh-136442: Fix unittest to return exit code 5 when setUpClass r…
pythongh-136442: Fix unittest to return exit code 5 when setUpClass r…
[3.13] gh-136442: Fix unittest to return exit code 5 when setUpClass …
[3.14] gh-136442: Fix unittest to return exit code 5 when setUpClass …
pythongh-136442: Fix unittest to return exit code 5 when setUpClass r…