Remove dependency on pytz

pytz will be removed from RHEL/CentOS 10 because of the built-in
zoneinfo[1].

Because the current usage of pytz can be very easily replaced, this
removes the dependency on pytz.

[1] https://issues.redhat.com/browse/RHEL-219

Change-Id: Iafcaf2f1095cd7c738dac391a9af10622806e932
This commit is contained in:
Takashi Kajinami 2024-01-27 19:41:53 +09:00
parent 93bef2405a
commit ea9ad2891c
3 changed files with 2 additions and 5 deletions

View File

@ -30,7 +30,6 @@ from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_utils import timeutils
from oslo_utils import uuidutils
import pytz
import requests
from ironic_inspector.cmd import all as inspector_cmd
@ -234,7 +233,7 @@ class Base(base.NodeTest):
# CI Runs in UTC, local machines can fail on the use of the local
# timezone.
curr_time = datetime.datetime.fromtimestamp(
time.time(), tz=pytz.timezone('UTC'))
time.time(), tz=datetime.timezone.utc)
started_at = timeutils.parse_isotime(status['started_at'])
self.assertLess(started_at, curr_time)
if finished:

View File

@ -23,7 +23,6 @@ from oslo_config import cfg
from oslo_log import log
from oslo_middleware import cors as cors_middleware
from oslo_middleware import healthcheck as healthcheck_middleware
import pytz
import webob
from ironic_inspector.common.i18n import _
@ -329,7 +328,7 @@ def get_inventory(data, node_info=None):
return inventory
def iso_timestamp(timestamp=None, tz=pytz.timezone('utc')):
def iso_timestamp(timestamp=None, tz=datetime.timezone.utc):
"""Return an ISO8601-formatted timestamp (tz: UTC) or None.
:param timestamp: such as time.time() or None

View File

@ -18,7 +18,6 @@ keystoneauth1>=4.2.0 # Apache-2.0
keystonemiddleware>=4.18.0 # Apache-2.0
netaddr>=0.7.18 # BSD
pbr>=3.1.1 # Apache-2.0
pytz>=2013.6 # MIT
PyYAML>=5.3.1
openstacksdk>=0.40.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0