mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #24522 -- Added a --shuffle option to DiscoverRunner.
This commit is contained in:
parent
77b88fe621
commit
90ba716bf0
10 changed files with 472 additions and 21 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue