diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-03-08 07:06:03 -0800 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-09 13:30:51 +0100 |
commit | 77e0a35a10e0b839d661ea88c12ec1facb2d4fb6 (patch) | |
tree | 2e841c6d766ce34f1a9fd7441f30afac88f8f8af /django/test/runner.py | |
parent | 98d3fd61026457a435ef5b7afce6b6e64e9f241d (diff) | |
download | django-77e0a35a10e0b839d661ea88c12ec1facb2d4fb6.tar.gz |
Fixed #32516 -- Fixed reorder_suite() with duplicates and reverse=True.
Diffstat (limited to 'django/test/runner.py')
-rw-r--r-- | django/test/runner.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/test/runner.py b/django/test/runner.py index 46c8c5842d..72863aa8fe 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -779,7 +779,7 @@ def reorder_suite(suite, classes, reverse=False): bins = [OrderedSet() for i in range(len(classes) + 1)] *class_bins, last_bin = bins - for test in iter_test_cases(suite, reverse=reverse): + for test in iter_test_cases(suite): for test_bin, test_class in zip(class_bins, classes): if isinstance(test, test_class): break @@ -787,6 +787,8 @@ def reorder_suite(suite, classes, reverse=False): test_bin = last_bin test_bin.add(test) + if reverse: + bins = (reversed(tests) for tests in bins) suite_class = type(suite) return suite_class(itertools.chain(*bins)) |