summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2021-04-24 16:46:16 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-07-08 07:29:04 +0200
commit90ba716bf060ee7fef79dc230b0b20644839069f (patch)
tree93ac388d4c3a75e5ab34edbf5a552305b72962d4 /docs/ref
parent77b88fe621bb7828535a4c4cf37d9d4ac01b146b (diff)
Fixed #24522 -- Added a --shuffle option to DiscoverRunner.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/django-admin.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 078f019de3..89d945500d 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -1425,11 +1425,30 @@ subsequent run. Unless the :setting:`MIGRATE <TEST_MIGRATE>` test setting is
``False``, any unapplied migrations will also be applied to the test database
before running the test suite.
+.. django-admin-option:: --shuffle [SEED]
+
+.. versionadded:: 4.0
+
+Randomizes the order of tests before running them. This can help detect tests
+that aren't properly isolated. The test order generated by this option is a
+deterministic function of the integer seed given. When no seed is passed, a
+seed is chosen randomly and printed to the console. To repeat a particular test
+order, pass a seed. The test orders generated by this option preserve Django's
+:ref:`guarantees on test order <order-of-tests>`. They also keep tests grouped
+by test case class.
+
+The shuffled orderings also have a special consistency property useful when
+narrowing down isolation issues. Namely, for a given seed and when running a
+subset of tests, the new order will be the original shuffling restricted to the
+smaller set. Similarly, when adding tests while keeping the seed the same, the
+order of the original tests will be the same in the new order.
+
.. django-admin-option:: --reverse, -r
Sorts test cases in the opposite execution order. This may help in debugging
the side effects of tests that aren't properly isolated. :ref:`Grouping by test
-class <order-of-tests>` is preserved when using this option.
+class <order-of-tests>` is preserved when using this option. This can be used
+in conjunction with ``--shuffle`` to reverse the order for a particular seed.
.. django-admin-option:: --debug-mode