Opened 3 years ago

Last modified 16 months ago

#32446 closed Cleanup/optimization

Deprecate the redundant SERIALIZE test database setting — at Version 1

Reported by: Simon Charette Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Simon Charette)

The SERIALIZE test database setting controls whether or not the content of test databases state should be serialized and restored between tests which enables the TransactionTestCase.serialized_rollback feature. It defaults to True and the documentation encourage turning it off to speed up test database creation time.

The requirements of having TransactionTestCase subclasses declare databases they are allowed to interact with that was introduced by #28478 paired with the requirement to opt-in the serialization behaviour through serialized_rollback=False allows the suite to determine if data state serialization for each test database is necessary at discovery time which makes the setting unnecessary.

I therefore suggest we deprecate the SERIALIZE test database and base per-database serialization on the subset of discovered TransactionTestCase.databases declared with serialized_rollback = True. This should change the default to avoiding unnecessary state serialization of test databases which can add up pretty quickly in large Django projects with a lot of apps and models (one unnecessary query for each model present).

Change History (1)

comment:1 by Simon Charette, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top