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/datetimes | |
parent | 7132d17de1399345a38858c20221850bdef43d0e (diff) | |
download | django-306607d5b99b6eca6ae2c1e726d8eb32b9b2ca1b.tar.gz |
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/datetimes')
-rw-r--r-- | tests/datetimes/tests.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/datetimes/tests.py b/tests/datetimes/tests.py index 7f98032e0a..95828f8e09 100644 --- a/tests/datetimes/tests.py +++ b/tests/datetimes/tests.py @@ -1,9 +1,14 @@ import datetime +import unittest -import pytz +try: + import pytz +except ImportError: + pytz = None -from django.test import TestCase, override_settings +from django.test import TestCase, ignore_warnings, override_settings from django.utils import timezone +from django.utils.deprecation import RemovedInDjango50Warning from .models import Article, Category, Comment @@ -91,7 +96,9 @@ class DateTimesTests(TestCase): qs = Article.objects.datetimes('pub_date', 'second') self.assertEqual(qs[0], now) - @override_settings(USE_TZ=True, TIME_ZONE='UTC') + @unittest.skipUnless(pytz is not None, 'Test requires pytz') + @ignore_warnings(category=RemovedInDjango50Warning) + @override_settings(USE_TZ=True, TIME_ZONE='UTC', USE_DEPRECATED_PYTZ=True) def test_datetimes_ambiguous_and_invalid_times(self): sao = pytz.timezone('America/Sao_Paulo') utc = pytz.UTC |