Fixed #26111 -- Clarified that fixtures are loaded once per TestCase.
This commit is contained in:
parent
cf48962b36
commit
02430ef19d
|
@ -1071,18 +1071,20 @@ subclass::
|
||||||
|
|
||||||
Here's specifically what will happen:
|
Here's specifically what will happen:
|
||||||
|
|
||||||
* At the start of each test case, before ``setUp()`` is run, Django will
|
* At the start of each test, before ``setUp()`` is run, Django will flush the
|
||||||
flush the database, returning the database to the state it was in
|
database, returning the database to the state it was in directly after
|
||||||
directly after :djadmin:`migrate` was called.
|
:djadmin:`migrate` was called.
|
||||||
|
|
||||||
* Then, all the named fixtures are installed. In this example, Django will
|
* Then, all the named fixtures are installed. In this example, Django will
|
||||||
install any JSON fixture named ``mammals``, followed by any fixture named
|
install any JSON fixture named ``mammals``, followed by any fixture named
|
||||||
``birds``. See the :djadmin:`loaddata` documentation for more
|
``birds``. See the :djadmin:`loaddata` documentation for more
|
||||||
details on defining and installing fixtures.
|
details on defining and installing fixtures.
|
||||||
|
|
||||||
This flush/load procedure is repeated for each test in the test case, so you
|
For performance reasons, :class:`TestCase` loads fixtures once for the entire
|
||||||
can be certain that the outcome of a test will not be affected by another test,
|
test class, before :meth:`~TestCase.setUpTestData`, instead of before each
|
||||||
or by the order of test execution.
|
test, and it uses transactions to clean the database before each test. In any case,
|
||||||
|
you can be certain that the outcome of a test will not be affected by another
|
||||||
|
test or by the order of test execution.
|
||||||
|
|
||||||
By default, fixtures are only loaded into the ``default`` database. If you are
|
By default, fixtures are only loaded into the ``default`` database. If you are
|
||||||
using multiple databases and set :attr:`multi_db=True
|
using multiple databases and set :attr:`multi_db=True
|
||||||
|
|
Loading…
Reference in New Issue