summaryrefslogtreecommitdiff
path: root/docs/topics/testing
diff options
context:
space:
mode:
authorJohannes Linke <johannes.linke@student.hpi.de>2016-02-11 21:32:24 +0100
committerTim Graham <timograham@gmail.com>2016-02-11 18:45:40 -0500
commit02430ef19d9a7d3663cbc1cf66438e9e86b919d1 (patch)
tree6c25e2ab0baa151bb302d494c9fe53747596fc07 /docs/topics/testing
parentcf48962b361b573e580b79839c19b640b7f304a2 (diff)
Fixed #26111 -- Clarified that fixtures are loaded once per TestCase.
Diffstat (limited to 'docs/topics/testing')
-rw-r--r--docs/topics/testing/tools.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index e4fa3cee0f..5b8908c485 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1071,18 +1071,20 @@ subclass::
Here's specifically what will happen:
-* At the start of each test case, before ``setUp()`` is run, Django will
- flush the database, returning the database to the state it was in
- directly after :djadmin:`migrate` was called.
+* At the start of each test, before ``setUp()`` is run, Django will flush the
+ database, returning the database to the state it was in directly after
+ :djadmin:`migrate` was called.
* Then, all the named fixtures are installed. In this example, Django will
install any JSON fixture named ``mammals``, followed by any fixture named
``birds``. See the :djadmin:`loaddata` documentation for more
details on defining and installing fixtures.
-This flush/load procedure is repeated for each test in the test case, so you
-can be certain that the outcome of a test will not be affected by another test,
-or by the order of test execution.
+For performance reasons, :class:`TestCase` loads fixtures once for the entire
+test class, before :meth:`~TestCase.setUpTestData`, instead of before each
+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
using multiple databases and set :attr:`multi_db=True