Skip to content

Commit 3581aa0

Browse files
committed
[Backend Tester] Add test flow CLI arg
ghstack-source-id: d6bbfc1 ghstack-comment-id: 3182028114 Pull-Request: #13360
1 parent 2993bf2 commit 3581aa0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

backends/test/suite/discovery.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class TestFilter:
2727
backends: set[str] | None
2828
""" The set of backends to include. If None, all backends are included. """
2929

30+
flows: set[str] | None
31+
""" The set of test flows to include. If None, all backends are included. """
32+
3033
name_regex: Pattern[str] | None
3134
""" A regular expression to filter test names. If None, all tests are included. """
3235

@@ -86,6 +89,9 @@ def _is_test_enabled(test_case: unittest.TestCase, test_filter: TestFilter) -> b
8689
if test_filter.backends is not None and flow.backend not in test_filter.backends:
8790
return False
8891

92+
if test_filter.flows is not None and flow.name not in test_filter.flows:
93+
return False
94+
8995
if test_filter.name_regex is not None and not test_filter.name_regex.search(
9096
test_case.id()
9197
):

backends/test/suite/runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def parse_args():
251251
parser.add_argument(
252252
"-b", "--backend", nargs="*", help="The backend or backends to test."
253253
)
254+
parser.add_argument("-l", "--flow", nargs="*", help="The flow or flows to test.")
254255
parser.add_argument(
255256
"-f", "--filter", nargs="?", help="A regular expression filter for test names."
256257
)
@@ -273,6 +274,7 @@ def parse_args():
273274
def build_test_filter(args: argparse.Namespace) -> TestFilter:
274275
return TestFilter(
275276
backends=set(args.backend) if args.backend is not None else None,
277+
flows=set(args.flow) if args.flow is not None else None,
276278
name_regex=re.compile(args.filter) if args.filter is not None else None,
277279
)
278280

0 commit comments

Comments
 (0)