diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-03-05 20:05:50 -0800 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-08 09:53:31 +0100 |
commit | 8ff75a3d9ec4290ad7108b2242ac8e6e2aa5d5ea (patch) | |
tree | ca2005f6353cc15f53db59b94b8774fae55076a9 /django/test/runner.py | |
parent | cc12894017c3b941c51f80b8d8e50da758f67802 (diff) | |
download | django-8ff75a3d9ec4290ad7108b2242ac8e6e2aa5d5ea.tar.gz |
Refs #32489 -- Simplified partition_suite_by_case().
Diffstat (limited to 'django/test/runner.py')
-rw-r--r-- | django/test/runner.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/django/test/runner.py b/django/test/runner.py index 02306090ea..aba4fc2b39 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -793,14 +793,11 @@ def reorder_suite(suite, classes, reverse=False): def partition_suite_by_case(suite): """Partition a test suite by test case, preserving the order of tests.""" - subsuites = [] suite_class = type(suite) - tests = iter_test_cases(suite) - for test_type, test_group in itertools.groupby(tests, type): - subsuite = suite_class(test_group) - subsuites.append(subsuite) - - return subsuites + all_tests = iter_test_cases(suite) + return [ + suite_class(tests) for _, tests in itertools.groupby(all_tests, type) + ] def filter_tests_by_tags(suite, tags, exclude_tags): |