Refs #32489 -- Simplified partition_suite_by_case().

This commit is contained in:
Chris Jerdonek 2021-03-05 20:05:50 -08:00 committed by Mariusz Felisiak
parent cc12894017
commit 8ff75a3d9e
1 changed files with 4 additions and 7 deletions

View File

@ -793,14 +793,11 @@ def reorder_suite(suite, classes, reverse=False):
def partition_suite_by_case(suite): def partition_suite_by_case(suite):
"""Partition a test suite by test case, preserving the order of tests.""" """Partition a test suite by test case, preserving the order of tests."""
subsuites = []
suite_class = type(suite) suite_class = type(suite)
tests = iter_test_cases(suite) all_tests = iter_test_cases(suite)
for test_type, test_group in itertools.groupby(tests, type): return [
subsuite = suite_class(test_group) suite_class(tests) for _, tests in itertools.groupby(all_tests, type)
subsuites.append(subsuite) ]
return subsuites
def filter_tests_by_tags(suite, tags, exclude_tags): def filter_tests_by_tags(suite, tags, exclude_tags):