From dba8010384e99828ae1cab5757f7e22c989ca550 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 16 Sep 2024 20:52:58 +0200 Subject: [PATCH] Simplify sub-test-suite handling in is_test_case_ignored No intended behavior change. Signed-off-by: Gilles Peskine --- tests/scripts/analyze_outcomes.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/scripts/analyze_outcomes.py b/tests/scripts/analyze_outcomes.py index cbe4ed4256..32f4ae3bb7 100755 --- a/tests/scripts/analyze_outcomes.py +++ b/tests/scripts/analyze_outcomes.py @@ -136,11 +136,19 @@ class Task: def section_name(self) -> str: """The section name to use in results.""" - def is_test_case_ignored(self, full_test_suite: str, test_string: str) -> bool: + def ignored_tests(self, test_suite: str) -> typing.Iterator[IgnoreEntry]: + """Generate the ignore list for the specified test suite.""" + if test_suite in self.IGNORED_TESTS: + yield from self.IGNORED_TESTS[test_suite] + pos = test_suite.find('.') + if pos != -1: + base_test_suite = test_suite[:pos] + if base_test_suite in self.IGNORED_TESTS: + yield from self.IGNORED_TESTS[base_test_suite] + + def is_test_case_ignored(self, test_suite: str, test_string: str) -> bool: """Check if the specified test case is ignored.""" - test_suite = full_test_suite.split('.')[0] # retrieve main part of test suite name - for str_or_re in (self.IGNORED_TESTS.get(full_test_suite, []) + - self.IGNORED_TESTS.get(test_suite, [])): + for str_or_re in self.ignored_tests(test_suite): if name_matches_pattern(test_string, str_or_re): return True return False