Refs #20392 -- Load fixtures once within TestCase

This commit is contained in:
Thomas Chaumeny 2014-12-04 14:05:59 +01:00 committed by Tim Graham
parent 0dea81cd6d
commit 119154ca7f
2 changed files with 50 additions and 33 deletions

View file

@ -67,6 +67,25 @@ to accept expressions other than aggregates. Aggregates are now able to
reference multiple fields, as well as perform arithmetic, similar to ``F()``
objects.
``TestCase`` data setup
~~~~~~~~~~~~~~~~~~~~~~~
:class:`~django.test.TestCase` has been refactored to allow for data
initialization at the class level using transactions and savepoints. Database
backends which do not support transactions, like MySQL with the MyISAM storage
engine, will still be able to run these tests but won't benefit from the
improvements. Tests are now run within two nested
:func:`~django.db.transaction.atomic()` blocks: one for the whole class and one
for each test.
* The class method
:meth:`TestCase.setUpTestData() <django.test.TestCase.setUpTestData>` adds
the ability to setup test data at the class level. Using this technique can
speed up the tests as compared to using ``setUp()``.
* Fixture loading within ``TestCase`` is now performed once for the whole
``TestCase``.
Minor features
~~~~~~~~~~~~~~
@ -515,10 +534,6 @@ Tests
* The :func:`~django.test.override_settings` decorator can now affect the
master router in :setting:`DATABASE_ROUTERS`.
* Added the ability to setup test data at the class level using
:meth:`TestCase.setUpTestData() <django.test.TestCase.setUpTestData>`. Using
this technique can speed up the tests as compared to using ``setUp()``.
* Added test client support for file uploads with file-like objects.
Validators