mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (#136487)
This commit is contained in:
parent
453d886f85
commit
53d65c840e
3 changed files with 26 additions and 5 deletions
|
|
@ -269,12 +269,12 @@ def runTests(self):
|
|||
testRunner = self.testRunner
|
||||
self.result = testRunner.run(self.test)
|
||||
if self.exit:
|
||||
if self.result.testsRun == 0 and len(self.result.skipped) == 0:
|
||||
sys.exit(_NO_TESTS_EXITCODE)
|
||||
elif self.result.wasSuccessful():
|
||||
sys.exit(0)
|
||||
else:
|
||||
if not self.result.wasSuccessful():
|
||||
sys.exit(1)
|
||||
elif self.result.testsRun == 0 and len(self.result.skipped) == 0:
|
||||
sys.exit(_NO_TESTS_EXITCODE)
|
||||
else:
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
main = TestProgram
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue