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/admin_widgets | |
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/admin_widgets')
-rw-r--r-- | tests/admin_widgets/tests.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 1bb4c9a9b1..3a57227caa 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -4,7 +4,10 @@ import re from datetime import datetime, timedelta from importlib import import_module -import pytz +try: + import zoneinfo +except ImportError: + from backports import zoneinfo from django import forms from django.conf import settings @@ -967,8 +970,8 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase): error_margin = timedelta(seconds=10) # If we are neighbouring a DST, we add an hour of error margin. - tz = pytz.timezone('America/Chicago') - utc_now = datetime.now(pytz.utc) + tz = zoneinfo.ZoneInfo('America/Chicago') + utc_now = datetime.now(zoneinfo.ZoneInfo('UTC')) tz_yesterday = (utc_now - timedelta(days=1)).astimezone(tz).tzname() tz_tomorrow = (utc_now + timedelta(days=1)).astimezone(tz).tzname() if tz_yesterday != tz_tomorrow: |