[Django] #23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always return True

13 views
Skip to first unread message

Django

unread,
Sep 5, 2014, 5:29:27 AM9/5/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-----------------------------------+--------------------
Reporter: gkoller | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------
Given the following in `settings.py`:

{{{
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
# ....
'TEST_SERIALIZE': False,
}
}
}}}

The call `serialize=connection.settings_dict.get("TEST_SERIALIZE", True)`
on line 299 in `django.test.runner.setup_databases` will always be set to
True as `TEST_SERIALIZE` is somewhere transformed into:

{{{
settings_dict = {
'TEST': {
'SERIALIZE`: True,
# ...
},
# ...
}
}}}

Hence the key lookup always fails, and `get()` will use the supplied
default value of `True`. A possible fix will be to rewrite that call to
something like:

{{{
serialize=connection.settings_dict["TEST"].get("SERIALIZE", True)
}}}

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

Django

unread,
Sep 5, 2014, 1:37:20 PM9/5/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-----------------------------------+------------------------------------

Reporter: gkoller | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Release blocker | 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 timgraham):

* severity: Normal => Release blocker
* needs_better_patch: => 0
* needs_tests: => 0
* easy: 1 => 0
* needs_docs: => 0
* stage: Unreviewed => Accepted


Comment:

Added in [8c12d51e]. Not sure what the intention was, but documenting that
it should be set in the test dictionary seems okay. It needs documentation
as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/23421#comment:1>

Django

unread,
Sep 9, 2014, 1:44:57 PM9/9/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-----------------------------------+------------------------------------

Reporter: gkoller | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

Comment (by timgraham):

Andrew says, "I think it was meant to be a way to turn off the full
serialization of data using loaddata during test runs; however it's
useless due to TransactionTestCases, so perhaps should be excised."

Was there a use case where you needed to set it to False?

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

Django

unread,
Sep 15, 2014, 10:07:19 AM9/15/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-----------------------------------+-------------------------------------
Reporter: gkoller | Owner: timgraham
Type: Bug | Status: assigned

Component: Testing framework | Version: 1.7
Severity: Release blocker | 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 timgraham):

* status: new => assigned
* owner: nobody => timgraham


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

Django

unread,
Sep 15, 2014, 11:23:49 AM9/15/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-----------------------------------+-------------------------------------
Reporter: gkoller | Owner: timgraham
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.7
Severity: Release blocker | 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 timgraham):

* has_patch: 0 => 1


Comment:

I found how the option could be useful:
[https://github.com/django/django/pull/3222 PR]

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

Django

unread,
Sep 24, 2014, 2:29:15 PM9/24/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-------------------------------------+-------------------------------------

Reporter: gkoller | Owner: timgraham
Type: Bug | Status: assigned
Component: Testing framework | Version: 1.7
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Markush2010):

* stage: Accepted => Ready for checkin


Comment:

Pull request looks good to me.

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

Django

unread,
Sep 24, 2014, 2:46:45 PM9/24/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-------------------------------------+-------------------------------------
Reporter: gkoller | Owner: timgraham
Type: Bug | Status: closed

Component: Testing framework | Version: 1.7
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"a4f23eba2e690f1331fe35d6f29af42899e80395"]:
{{{
#!CommitTicketReference repository=""
revision="a4f23eba2e690f1331fe35d6f29af42899e80395"
Fixed #23421 -- Corrected TEST SERIALIZE setting.

Thanks gkoller for the report.
}}}

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

Django

unread,
Sep 24, 2014, 2:51:20 PM9/24/14
to django-...@googlegroups.com
#23421: dict get for TEST_SERIALIZE in django.test.runner.setup_databases() always
return True
-------------------------------------+-------------------------------------
Reporter: gkoller | Owner: timgraham
Type: Bug | Status: closed
Component: Testing framework | Version: 1.7
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"02aa3e30e9cb8e5be5c33082c3548e2a6e1b91cb"]:
{{{
#!CommitTicketReference repository=""
revision="02aa3e30e9cb8e5be5c33082c3548e2a6e1b91cb"
[1.7.x] Fixed #23421 -- Corrected TEST SERIALIZE setting.

Thanks gkoller for the report and Markus Holtermann for review.
}}}

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

Reply all
Reply to author
Forward
0 new messages