#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: nobody
Type: | Status: assigned
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Simon Charette:
Old description:
> The [https://docs.djangoproject.com/en/3.1/ref/settings/#serialize
> 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`
> [https://docs.djangoproject.com/en/3.1/topics/testing/overview/#test-
> case-serialized-rollback feature] 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).
New description:
The [https://docs.djangoproject.com/en/3.1/ref/settings/#serialize
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`
[https://docs.djangoproject.com/en/3.1/topics/testing/overview/#test-case-
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).
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.6847b786efe3cdef98d02d8a4245ffd1%40djangoproject.com.