Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Return the correct exit code if all tests have been skipped inunittest #106584

Closed
Labels
3.12only security fixes3.13bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@EliseevEgor

Description

@EliseevEgor

Bug report

In Python 3.12, a new exit code (5, instead of0) wasadded if all tests were skipped inunittest. But in some cases it still returns0. See code examples.

Code example 1:

importunittestclassTestSimple(unittest.TestCase):@classmethoddefsetUpClass(cls):raiseunittest.SkipTest("Skip whole Case")deftest_true(self):self.assertTrue(True)deftest_false(self):self.assertTrue(False,msg="Is not True")

Output:

Ran 0 tests in 0.000sNO TESTS RAN (skipped=1)

Ok, we get exit code 5 here.

Code example 2:

importunittestclassTestCase(unittest.TestCase):@unittest.skip("something")deftest(self):self.assertTrue(False)

Output:

Ran 1 test in 0.000sOK (skipped=1)

Here we can see output0. Ran one test and skipped. But I think it is incorrect, because all tests were skipped.

Your environment

  • CPython versions tested on: 3.12
  • Operating system and architecture: I think it does not matter.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp