1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +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:
Carlton Gibson
2021-09-09 15:15:44 +02:00
parent 7132d17de1
commit 306607d5b9
27 changed files with 635 additions and 280 deletions

View File

@@ -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