[Django] #32446: Deprecate the redundant SERIALIZE test database setting

38 views
Skip to first unread message

Django

unread,
Feb 14, 2021, 10:25:15 PM2/14/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
------------------------------------------------+--------------------------
Reporter: Simon Charette | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
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 [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).

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

Django

unread,
Feb 14, 2021, 10:25:46 PM2/14/21
to django-...@googlegroups.com
#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

unread,
Feb 15, 2021, 12:41:17 AM2/15/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette

Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

* owner: nobody => Simon Charette
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:2>

Django

unread,
Feb 15, 2021, 4:37:47 AM2/15/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1


Comment:

[https://github.com/django/django/pull/14010 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:3>

Django

unread,
Feb 19, 2021, 7:27:16 AM2/19/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:4>

Django

unread,
Feb 24, 2021, 7:41:04 AM2/24/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:5>

Django

unread,
Feb 24, 2021, 3:15:49 PM2/24/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3089018e951dcca568574c0e0ebf9d8aab112389" 3089018e]:
{{{
#!CommitTicketReference repository=""
revision="3089018e951dcca568574c0e0ebf9d8aab112389"
Fixed #32446 -- Deprecated SERIALIZE test database setting.

Whether or not the state of a test database should be serialized can be
inferred from the set of databases allowed to be access from discovered
TestCase/TransactionTestCase enabling the serialized_rollback feature
which makes this setting unnecessary.

This should make a significant test suite bootstraping time difference
on large projects that didn't explicitly disable test database
serialization.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:6>

Django

unread,
Feb 27, 2021, 6:14:04 AM2/27/21
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: closed
Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam Johnson):

Great work! I will be able to delete a section in my book now.

--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:7>

Django

unread,
Jan 17, 2023, 5:49:43 AM1/17/23
to django-...@googlegroups.com
#32446: Deprecate the redundant SERIALIZE test database setting
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: closed
Component: Testing framework | Version: dev

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"6c0539ed7c7a1ddeaac3ff91622ebf7a8c8442b9" 6c0539ed]:
{{{
#!CommitTicketReference repository=""
revision="6c0539ed7c7a1ddeaac3ff91622ebf7a8c8442b9"
Refs #32446 -- Removed SERIALIZE test database setting per deprecation
timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32446#comment:8>

Reply all
Reply to author
Forward
0 new messages