From 306607d5b99b6eca6ae2c1e726d8eb32b9b2ca1b Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 9 Sep 2021 15:15:44 +0200 Subject: 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. --- tests/datetimes/tests.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/datetimes') 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 -- cgit v1.2.1