mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Refs #20392 -- Load fixtures once within TestCase
This commit is contained in:
parent
0dea81cd6d
commit
119154ca7f
2 changed files with 50 additions and 33 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue