Drop dependency on iso8601
iso8601.iso8601.UTC has been equivalent to datetime.timezone.utc in Python 3. Because python 2 is no longer supported, we can directly use the built-in implementation. Change-Id: I3c2cb1b4d7ae0251cde5a54bd458aa1c80b9b783
This commit is contained in:
@@ -20,7 +20,6 @@ import uuid
|
||||
import warnings
|
||||
|
||||
import copy
|
||||
import iso8601
|
||||
import netaddr
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
@@ -485,7 +484,7 @@ class DateTime(FieldType):
|
||||
# NOTE(danms): Legacy objects from sqlalchemy are stored in UTC,
|
||||
# but are returned without a timezone attached.
|
||||
# As a transitional aid, assume a tz-naive object is in UTC.
|
||||
value = value.replace(tzinfo=iso8601.UTC)
|
||||
value = value.replace(tzinfo=datetime.timezone.utc)
|
||||
elif not self.tzinfo_aware:
|
||||
value = value.replace(tzinfo=None)
|
||||
return value
|
||||
|
||||
@@ -16,7 +16,6 @@ import datetime
|
||||
from unittest import mock
|
||||
import warnings
|
||||
|
||||
import iso8601
|
||||
import netaddr
|
||||
import testtools
|
||||
|
||||
@@ -572,7 +571,7 @@ class TestFlexibleBoolean(TestField):
|
||||
class TestDateTime(TestField):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.dt = datetime.datetime(1955, 11, 5, tzinfo=iso8601.iso8601.UTC)
|
||||
self.dt = datetime.datetime(1955, 11, 5, tzinfo=datetime.timezone.utc)
|
||||
self.field = fields.DateTimeField()
|
||||
self.coerce_good_values = [(self.dt, self.dt),
|
||||
(_utils.isotime(self.dt), self.dt)]
|
||||
@@ -585,7 +584,7 @@ class TestDateTime(TestField):
|
||||
'1955-11-05T18:00:00Z',
|
||||
self.field.stringify(
|
||||
datetime.datetime(1955, 11, 5, 18, 0, 0,
|
||||
tzinfo=iso8601.iso8601.UTC)))
|
||||
tzinfo=datetime.timezone.utc)))
|
||||
|
||||
def test_get_schema(self):
|
||||
self.assertEqual({'type': ['string'], 'format': 'date-time',
|
||||
|
||||
@@ -18,8 +18,6 @@ import hashlib
|
||||
import inspect
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
|
||||
from oslo_versionedobjects import base
|
||||
from oslo_versionedobjects import exception
|
||||
from oslo_versionedobjects import fields
|
||||
@@ -189,7 +187,7 @@ class TestObjectComparators(test.TestCase):
|
||||
def test_compare_obj_with_dt(self):
|
||||
mock_test = mock.Mock()
|
||||
mock_test.assertEqual = mock.Mock()
|
||||
dt = datetime.datetime(1955, 11, 5, tzinfo=iso8601.iso8601.UTC)
|
||||
dt = datetime.datetime(1955, 11, 5, tzinfo=datetime.timezone.utc)
|
||||
replaced_dt = dt.replace(tzinfo=None)
|
||||
my_obj = self.MyComparedObjectWithTZ(tzfield=dt)
|
||||
my_db_obj = {'tzfield': replaced_dt}
|
||||
|
||||
@@ -8,7 +8,6 @@ oslo.context>=2.19.2 # Apache-2.0
|
||||
oslo.messaging>=5.29.0 # Apache-2.0
|
||||
oslo.serialization>=2.18.0 # Apache-2.0
|
||||
oslo.utils>=7.4.0 # Apache-2.0
|
||||
iso8601>=0.1.11 # MIT
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
WebOb>=1.7.1 # MIT
|
||||
|
||||
Reference in New Issue
Block a user