Repository navigation
Return the correct exit code if all tests have been skipped in unittest #106584
Copy link
Copy link
Closed
Labels
3.12only security fixesonly security fixes3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 10, 2023 - added a commit that references this issue
on Jul 10, 2023 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory3.12only security fixesonly security fixes3.13only security fixesonly security fixes
on Jul 10, 2023 - added a commit that references this issue
on Sep 22, 2023 1 remaining item
I think that it was a wrong change, and not only because it makes
startTest()andstopTest()calls unbalanced (#113267), but because it does not solve the original issue. The third example should be equivalent to the second example:import unittest class TestCase(unittest.TestCase): def test(self): self.skipTest("something")
But it gets error code 0 while the second example gets error code 5.
It also gives a wrong answer to the problem. #113661 fixes it in the opposite way.
Reacted by Erlend E. Aasland- moved this from Done to In Progress in Unittest & doctest issues
on Jan 23, 2024 Looks like this change has been reverted, and #113661 PRs are merged also, and that issue is closed. Seems there is nothing left to do here?
- moved this from In Progress to Done in Unittest & doctest issues
on Feb 29, 2024
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Bug report
In Python 3.12, a new exit code (
5, instead of0) was added if all tests were skipped inunittest. But in some cases it still returns0. See code examples.Code example 1:
Output:
Ok, we get exit code 5 here.
Code example 2:
Output:
Here we can see output
0. Ran one test and skipped. But I think it is incorrect, because all tests were skipped.Your environment
Linked PRs