[Django] #34193: TestCase _fixture_teardown breaks database MIRROR usage

4 views
Skip to first unread message

Django

unread,
Nov 30, 2022, 11:03:00 AM11/30/22
to django-...@googlegroups.com
#34193: TestCase _fixture_teardown breaks database MIRROR usage
---------------------------------------------+------------------------
Reporter: Jean-Daniel | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
The TestCase class _fixture_teardown() implementation try to iterate over
all databases while it should ignore MIRROR databases.

Trying to include MIRROR database in the iteration loop make the teardown
be execute twice on the database and raise an exception.

{{{
for db_name in reversed(self._databases_names()):
}}}


Should be

{{{
for db_name in reversed(self._databases_names(include_mirrors=False)):
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34193>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 30, 2022, 11:31:32 PM11/30/22
to django-...@googlegroups.com
#34193: TestCase _fixture_teardown breaks database MIRROR usage
-----------------------------------+--------------------------------------
Reporter: Jean-Daniel | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 4.1
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

I think it's a duplicate of #23718. `TEST['MIRROR']` requires
`TransactionTestCase` to work with multiple databases.

--
Ticket URL: <https://code.djangoproject.com/ticket/34193#comment:1>

Reply all
Reply to author
Forward
0 new messages