One super nit-pick comment below, even without that though I still think this looks good.
Reviewed-by: Jeremy Spewock <jspew...@iol.unh.edu> On Mon, Sep 23, 2024 at 11:02 AM Juraj Linkeš <juraj.lin...@pantheon.tech> wrote: <snip> > + def is_test_case(function: Callable) -> bool: > + if inspect.isfunction(function): > + # TestCase is not used at runtime, so we can't use > isinstance() with `function`. > + # But function.test_type exists. > + if hasattr(function, "test_type"): > + return isinstance(function.test_type, TestCaseType) > + return False > + > + if test_case_sublist is None: > + test_case_sublist = [] > + > + # the copy is needed so that the condition "elif test_case_sublist" > doesn't > + # change mid-cycle > + test_case_sublist_copy = list(test_case_sublist) > + func_test_cases = set() > + perf_test_cases = set() > + > + for test_case_name, test_case_function in inspect.getmembers(cls, > is_test_case): > + if test_case_name in test_case_sublist_copy: > + # if test_case_sublist_copy is non-empty, remove the found > test case > + # so that we can look at the remainder at the end > + test_case_sublist_copy.remove(test_case_name) > + elif test_case_sublist: > + # the original list not being empty means we're filtering > test cases This might read a little better if there was a period at the end, but I still think this gets the point across as is. > + # since we didn't remove test_case_name in the previous > branch, > + # it doesn't match the filter and we don't want to remove it > + continue > + > + match test_case_function.test_type: > + case TestCaseType.PERFORMANCE: > + perf_test_cases.add(test_case_function) > + case TestCaseType.FUNCTIONAL: > + func_test_cases.add(test_case_function) > + <snip> > 2.43.0 >