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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user