summaryrefslogtreecommitdiff
path: root/django/test/runner.py
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2021-03-08 07:06:03 -0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-09 13:30:51 +0100
commit77e0a35a10e0b839d661ea88c12ec1facb2d4fb6 (patch)
tree2e841c6d766ce34f1a9fd7441f30afac88f8f8af /django/test/runner.py
parent98d3fd61026457a435ef5b7afce6b6e64e9f241d (diff)
downloaddjango-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.py4
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))