diff --git a/backends/test/suite/discovery.py b/backends/test/suite/discovery.py index 92de356f550..34e588850ac 100644 --- a/backends/test/suite/discovery.py +++ b/backends/test/suite/discovery.py @@ -27,6 +27,9 @@ class TestFilter: backends: set[str] | None """ The set of backends to include. If None, all backends are included. """ + flows: set[str] | None + """ The set of test flows to include. If None, all backends are included. """ + name_regex: Pattern[str] | None """ A regular expression to filter test names. If None, all tests are included. """ @@ -86,6 +89,9 @@ def _is_test_enabled(test_case: unittest.TestCase, test_filter: TestFilter) -> b if test_filter.backends is not None and flow.backend not in test_filter.backends: return False + if test_filter.flows is not None and flow.name not in test_filter.flows: + return False + if test_filter.name_regex is not None and not test_filter.name_regex.search( test_case.id() ): diff --git a/backends/test/suite/runner.py b/backends/test/suite/runner.py index 6caf27afe92..7a1fb64989a 100644 --- a/backends/test/suite/runner.py +++ b/backends/test/suite/runner.py @@ -251,6 +251,7 @@ def parse_args(): parser.add_argument( "-b", "--backend", nargs="*", help="The backend or backends to test." ) + parser.add_argument("-l", "--flow", nargs="*", help="The flow or flows to test.") parser.add_argument( "-f", "--filter", nargs="?", help="A regular expression filter for test names." ) @@ -273,6 +274,7 @@ def parse_args(): def build_test_filter(args: argparse.Namespace) -> TestFilter: return TestFilter( backends=set(args.backend) if args.backend is not None else None, + flows=set(args.flow) if args.flow is not None else None, name_regex=re.compile(args.filter) if args.filter is not None else None, )