Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27127 closed Bug (duplicate)

Overriding timezone in test forces them to be TestCase

Reported by: tpazderka Owned by: nobody
Component: Testing framework Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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:

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:

SET TIME ZONE 'Europe/Prague'

Change History (7)

comment:1 by tpazderka, 8 years ago

Component: UncategorizedTesting framework

comment:2 by Tim Graham, 8 years ago

Resolution: duplicate
Status: newclosed

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

comment:3 by tpazderka, 8 years ago

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

comment:4 by Tim Graham, 8 years ago

No, I don't think it qualifies per our supported versions policy.

comment:5 by tpazderka, 8 years ago

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

comment:6 by Tim Graham, 8 years ago

in reply to:  6 comment:7 by tpazderka, 8 years ago

Replying to timgraham:

You can use SimpleTestCase.allow_database_queries.

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

Note: See TracTickets for help on using tickets.
Back to Top