Skip to content

Possible typo in the documentation of unittest.TestLoader.testNamePatterns #100824

Closed
@busywhitespace

Description

@busywhitespace

The documentation for TestLoader.testNamePatterns in the module unittest says:

List of Unix shell-style wildcard test name patterns that test methods have to match to be included in test suites (see -v option).
...
Note that matches are always performed using fnmatch.fnmatchcase(), so unlike patterns passed to the -v option, simple substring patterns will have to be converted using * wildcards.

But the option -v only increases verbosity, does not accept an argument, and so doesn't work with test name patterns.

In my opinion, it should be an option -k, because the option -k is used to pass a pattern as the output of unittest --help says:

-k TESTNAMEPATTERNS Only run tests which match the given substring

Also checking the source code, -k is bound to testNamePatterns

parser.add_argument('-k', dest='testNamePatterns',
                    action='append', type=_convert_select_pattern,
                    help='Only run tests which match the given substring')

I've created the PR in case the issue is correct.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions