summaryrefslogtreecommitdiff
path: root/tests/settings_tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2021-05-14 15:58:45 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-05-18 20:26:44 +0200
commit8cd55021bcb6c9727c1adccd9623fa4acfc0312b (patch)
tree6a5a411a0c07bf88e8c550bb94e4ee9f148ccb26 /tests/settings_tests
parent958cdf65ae90d26236d1815bbba804729595ec7a (diff)
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>
Diffstat (limited to 'tests/settings_tests')
-rw-r--r--tests/settings_tests/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index c0c53fe391..ba38fd87ba 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -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')