Skip to content

regrtest --list-cases lists a test module that fails to import #163032

Backlog

Description

@fedonman

Bug description:

Since GH-151689 (gh-109817), python -m test --list-cases prints the bare name of a test module that fails to import among the test case ids. The option is documented to "only write the name of test cases that will be run", and Lib/test/bisect_cmd.py treats every line it prints as a test id. 3.15 left such a module out.

$ mkdir tests
$ printf 'import does_not_exist\n' > tests/test_broken.py
$ printf 'import unittest\nclass T(unittest.TestCase):\n    def test_a(self): pass\n' > tests/test_ok.py
$ python -m test --testdir tests --list-cases test_broken test_ok
test_broken
test_ok.T.test_a

3.15.0 prints:

test_ok.T.test_a

Expected: the 3.15 output.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    tests
    type-bug
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    teststype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions