class TestCase
[source]
This is the most common class to use for writing tests in Django. It inherits from TransactionTestCase
(and by extension SimpleTestCase
). If your Django application doesn’t use a database, use SimpleTestCase
.
The class:
- Wraps the tests within two nested
atomic()
blocks: one for the whole class and one for each test. Therefore, if you want to test some specific database transaction behavior, useTransactionTestCase
. - Checks deferrable database constraints at the end of each test.
Changed in Django 1.10:
The check for deferrable database constraints at the end of each test was added.
It also provides an additional method:
Please login to continue.