#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 , 9 years ago
| Component: | Uncategorized → Testing framework |
|---|
comment:2 by , 9 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
comment:5 by , 9 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:7 by , 9 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.
Looks like a duplicate of #26712, please reopen with more details if not.