diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-09-09 15:15:44 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-09-16 12:11:05 +0200 |
| commit | 306607d5b99b6eca6ae2c1e726d8eb32b9b2ca1b (patch) | |
| tree | 607d1b06feafaf28fc2e09c70652d30659707537 /tests/settings_tests/tests.py | |
| parent | 7132d17de1399345a38858c20221850bdef43d0e (diff) | |
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.
Diffstat (limited to 'tests/settings_tests/tests.py')
| -rw-r--r-- | tests/settings_tests/tests.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 899059764e..e958a984fa 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -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): |
