mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #32379 -- Started deprecation toward changing default USE_TZ to True.
Co-authored-by: Nick Pope <nick@nickpope.me.uk> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
committed by
Mariusz Felisiak
parent
958cdf65ae
commit
8cd55021bc
@@ -13,6 +13,7 @@ from django.test import (
|
||||
)
|
||||
from django.test.utils import requires_tz_support
|
||||
from django.urls import clear_script_prefix, set_script_prefix
|
||||
from django.utils.deprecation import RemovedInDjango50Warning
|
||||
|
||||
|
||||
@modify_settings(ITEMS={
|
||||
@@ -332,6 +333,21 @@ class SettingsTests(SimpleTestCase):
|
||||
with self.assertRaisesMessage(ValueError, 'Incorrect timezone setting: test'):
|
||||
settings._setup()
|
||||
|
||||
def test_use_tz_false_deprecation(self):
|
||||
settings_module = ModuleType('fake_settings_module')
|
||||
settings_module.SECRET_KEY = 'foo'
|
||||
sys.modules['fake_settings_module'] = settings_module
|
||||
msg = (
|
||||
'The default value of USE_TZ will change from False to True in '
|
||||
'Django 5.0. Set USE_TZ to False in your project settings if you '
|
||||
'want to keep the current default behavior.'
|
||||
)
|
||||
try:
|
||||
with self.assertRaisesMessage(RemovedInDjango50Warning, msg):
|
||||
Settings('fake_settings_module')
|
||||
finally:
|
||||
del sys.modules['fake_settings_module']
|
||||
|
||||
|
||||
class TestComplexSettingOverride(SimpleTestCase):
|
||||
def setUp(self):
|
||||
@@ -398,6 +414,7 @@ class IsOverriddenTest(SimpleTestCase):
|
||||
def test_module(self):
|
||||
settings_module = ModuleType('fake_settings_module')
|
||||
settings_module.SECRET_KEY = 'foo'
|
||||
settings_module.USE_TZ = False
|
||||
sys.modules['fake_settings_module'] = settings_module
|
||||
try:
|
||||
s = Settings('fake_settings_module')
|
||||
|
||||
Reference in New Issue
Block a user