#36008: TransactionTestCase.databases discrepancy
-------------------------------------+-------------------------------------
Reporter: Sviatoslav Abakumov | Type: Bug
Status: new | Component:
| Documentation
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
The docs on
[
https://docs.djangoproject.com/en/5.1/topics/testing/tools/#django.test.TransactionTestCase.databases
django.test.TransactionTestCase.databases] mention that Django flushes the
test DB at the start of the test run (emphasis mine):
> However, a big part of the time taken to run a Django `TestCase` is
consumed by the call to `flush` that ensures that you have a clean
database **at the start** of each test run.
> As an optimization, Django only flushes the `default` database **at the
start** of each test run.
However, after tracing the code, I believe that Django flushes the DB
[
https://github.com/django/django/blob/stable/5.1.x/django/test/testcases.py#L1236-L1244
at the end] of the test run.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36008>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.