Skip to content

regrtest: allow to intermix --match and --ignore options #110918

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Feature or enhancement

Currently you can use --match and --ignore options for positive and negative filtering of test cases by name. But negative patterns always win. So you can select a class of tests and then exclude some tests from it, but you cannot exclude a class of tests except some tests.

Many programs that have similar options (can also be named --include/--exclude) use different algorithm. They apply rules in the order, and the last rule wins. I propose to implement this in Python regrtests too. Examples:

Run FileTests tests in test_os, excluding test_write:

./python -m test test_os -m FileTests -i test_write

Run all tests in test_os, excluding FileTests tests, but including test_write:

./python -m test test_os -i FileTests -m test_write

And, of course, any combinations are valid. This applies also to options that read patterns from files: --matchfile and --ignorefile. The implementation is actually somewhat simpler than the current one.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixestestsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions