[4.1.x] Fixed #23718 -- Doc'd that test mirrors require TransactionTestCase.

Co-authored-by: Christian Bundy <me@christianbundy.com>

Backport of 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 from main
This commit is contained in:
sarahboyce 2023-01-15 19:50:36 +01:00 committed by Mariusz Felisiak
parent d805010d68
commit d550e3cccd
2 changed files with 6 additions and 2 deletions

View File

@ -839,7 +839,9 @@ but for all apps.
Default: ``None`` Default: ``None``
The alias of the database that this database should mirror during The alias of the database that this database should mirror during
testing. testing. It depends on transactions and therefore must be used within
:class:`~django.test.TransactionTestCase` instead of
:class:`~django.test.TestCase`.
This setting exists to allow for testing of primary/replica This setting exists to allow for testing of primary/replica
(referred to as master/slave by some databases) (referred to as master/slave by some databases)

View File

@ -230,7 +230,9 @@ will *not* be created. Instead the connection to ``replica``
will be redirected to point at ``default``. As a result, writes to will be redirected to point at ``default``. As a result, writes to
``default`` will appear on ``replica`` -- but because they are actually ``default`` will appear on ``replica`` -- but because they are actually
the same database, not because there is data replication between the the same database, not because there is data replication between the
two databases. two databases. As this depends on transactions, the tests must use
:class:`~django.test.TransactionTestCase` instead of
:class:`~django.test.TestCase`.
.. _topics-testing-creation-dependencies: .. _topics-testing-creation-dependencies: