diff --git a/tests/performance/api/test.py b/tests/performance/api/test.py index bb5443150c8..28636fb7a5f 100644 --- a/tests/performance/api/test.py +++ b/tests/performance/api/test.py @@ -65,11 +65,22 @@ class TestCollection: continue test_name = test.name() - found = False + + included = False + excluded = False + for name_filter in names_filter: - if fnmatch.fnmatch(test_name, name_filter): - found = True - if not found: + is_exclusion = name_filter.startswith('!') + pattern = name_filter[1:] if is_exclusion else name_filter + + if fnmatch.fnmatch(test_name, pattern): + if is_exclusion: + excluded = True + break + else: + included = True + + if not included or excluded: continue self.tests.append(test)