[Django] #27127: Overriding timezone in test forces them to be TestCase

16 views
Skip to first unread message

Django

unread,
Aug 26, 2016, 8:36:36 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-------------------------------+--------------------
Reporter: tpazderka | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Changing settings of timezone during tests forces them to be `TestCase`
instead of `SimpleTestCase`. I do believe that this change shouldn't force
the test to be `TestCase`.
Testcase:
{{{
#!python
from django.test import SimpleTestCase, override_settings


class TimezoneTest(SimpleTestCase):
def test_tz(self):
with override_settings(USE_TZ=False):
pass
with override_settings(USE_TZ=True):
pass
}}}

The only query executed during this test is:
{{{
#!sql
SET TIME ZONE 'Europe/Prague'
}}}

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

Django

unread,
Aug 26, 2016, 8:36:57 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------

Reporter: tpazderka | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.10
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
-----------------------------------+--------------------------------------
Changes (by tpazderka):

* needs_better_patch: => 0
* component: Uncategorized => Testing framework
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Aug 26, 2016, 8:48:07 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* resolution: => duplicate


Comment:

Looks like a duplicate of #26712, please reopen with more details if not.

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

Django

unread,
Aug 26, 2016, 8:56:06 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody

Type: Bug | Status: closed
Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by tpazderka):

Yes, that is indeed the case. Is there a backport planned to 1.10?

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

Django

unread,
Aug 26, 2016, 9:15:30 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody

Type: Bug | Status: closed
Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

No, I don't think it qualifies per our
[https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy].

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

Django

unread,
Aug 26, 2016, 9:23:58 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody

Type: Bug | Status: closed
Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by tpazderka):

I think that it could be considered as a regression since this test starts
to fail in 1.9, but passes up until then.

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

Django

unread,
Aug 26, 2016, 9:32:13 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody

Type: Bug | Status: closed
Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

You can use
[https://docs.djangoproject.com/en/stable/topics/testing/tools/#django.test.SimpleTestCase.allow_database_queries
SimpleTestCase.allow_database_queries].

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

Django

unread,
Aug 26, 2016, 9:33:47 AM8/26/16
to django-...@googlegroups.com
#27127: Overriding timezone in test forces them to be TestCase
-----------------------------------+--------------------------------------
Reporter: tpazderka | Owner: nobody

Type: Bug | Status: closed
Component: Testing framework | Version: 1.10
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by tpazderka):

Replying to [comment:6 timgraham]:

Yes, I know. We were hoping to avoid that. Thanks for the consideration.

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

Reply all
Reply to author
Forward
0 new messages