1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #22491 -- documented how select_for_update() should be tested.

Thanks Andreas Pelme for the report.
This commit is contained in:
Moayad Mardini
2014-07-27 11:12:39 +03:00
committed by Tim Graham
parent 0af593dbe5
commit 668d432d0a
2 changed files with 21 additions and 7 deletions

View File

@@ -636,7 +636,10 @@ to test the effects of commit and rollback:
While ``commit`` and ``rollback`` operations still *appear* to work when
used in ``TestCase``, no actual commit or rollback will be performed by the
database. This can cause your tests to pass or fail unexpectedly. Always
use ``TransactionTestCase`` when testing transactional behavior.
use ``TransactionTestCase`` when testing transactional behavior or any code
that can't normally be excuted in autocommit mode
(:meth:`~django.db.models.query.QuerySet.select_for_update()` is an
example).
``TransactionTestCase`` inherits from :class:`~django.test.SimpleTestCase`.