#36008 closed Bug (fixed)
Document that TransactionTestCase.databases calls flush at the end of each test run
Reported by: | Sviatoslav Abakumov | Owned by: | Chiemezuo |
---|---|---|---|
Component: | Testing framework | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Jacob Walls | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The docs on 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 toflush
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 at the end of the test run.
Change History (8)
comment:1 by , 5 days ago
Cc: | added |
---|---|
Component: | Documentation → Testing framework |
Summary: | TransactionTestCase.databases discrepancy → Document that TransactionTestCase.databases calls flush at the end of each test run |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 days ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:3 by , 5 days ago
Hi!
I'd be very willing to work on this. Also, I'm a first-time contributor here and have previously never used trac, so my apologies if I don't get the contribution flow exactly as it should be. I'd be glad to take corrections as well!
I read that I could claim a ticket just by assigning it to myself here: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#claiming-tickets
comment:4 by , 3 days ago
Has patch: | set |
---|
comment:6 by , 2 days ago
Triage Stage: | Accepted → Ready for checkin |
---|
I think you're right 👍 thank you