mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32365 -- Made zoneinfo the default timezone implementation.
Thanks to Adam Johnson, Aymeric Augustin, David Smith, Mariusz Felisiak, Nick Pope, and Paul Ganssle for reviews.
This commit is contained in:
@@ -4,7 +4,10 @@ import unittest
|
||||
from types import ModuleType, SimpleNamespace
|
||||
from unittest import mock
|
||||
|
||||
from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings
|
||||
from django.conf import (
|
||||
ENVIRONMENT_VARIABLE, USE_DEPRECATED_PYTZ_DEPRECATED_MSG, LazySettings,
|
||||
Settings, settings,
|
||||
)
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.http import HttpRequest
|
||||
from django.test import (
|
||||
@@ -348,6 +351,21 @@ class SettingsTests(SimpleTestCase):
|
||||
finally:
|
||||
del sys.modules['fake_settings_module']
|
||||
|
||||
def test_use_deprecated_pytz_deprecation(self):
|
||||
settings_module = ModuleType('fake_settings_module')
|
||||
settings_module.USE_DEPRECATED_PYTZ = True
|
||||
settings_module.USE_TZ = True
|
||||
sys.modules['fake_settings_module'] = settings_module
|
||||
try:
|
||||
with self.assertRaisesMessage(RemovedInDjango50Warning, USE_DEPRECATED_PYTZ_DEPRECATED_MSG):
|
||||
Settings('fake_settings_module')
|
||||
finally:
|
||||
del sys.modules['fake_settings_module']
|
||||
|
||||
holder = LazySettings()
|
||||
with self.assertRaisesMessage(RemovedInDjango50Warning, USE_DEPRECATED_PYTZ_DEPRECATED_MSG):
|
||||
holder.configure(USE_DEPRECATED_PYTZ=True)
|
||||
|
||||
|
||||
class TestComplexSettingOverride(SimpleTestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user