iso8601.is8601.Utc No Longer Exists

iso8601.UTC is correct datetime UTC field object.
iso8601 >= 0.1.12 includes only iso8601.UTC for python3
while both UTC and Utc() for python2. Less then 0.1.12
included both UTC and Utc() for both python2/3.

Change-Id: I10b84a9cc7f0cc8ea213a377e4c4f16168b6e45b
Closes-Bug: #1713354
This commit is contained in:
Sean McCully 2017-08-27 22:14:02 -04:00
parent a21cac214c
commit 3d86ae664a
12 changed files with 22 additions and 22 deletions

View File

@ -242,7 +242,7 @@ class SimpleTenantUsageController(wsgi.Controller):
# instance object fields and still maintain backwards compatibility
# in the API.
if value.utcoffset() is None:
value = value.replace(tzinfo=iso8601.iso8601.Utc())
value = value.replace(tzinfo=iso8601.UTC)
return value
def _get_datetime_range(self, req):

View File

@ -94,7 +94,7 @@ def set_update_time_on_success(function):
else:
now = timeutils.utcnow()
# NOTE(sbauza): Objects are UTC tz-aware by default
self.updated = now.replace(tzinfo=iso8601.iso8601.Utc())
self.updated = now.replace(tzinfo=iso8601.UTC)
return return_value
return decorated_function

View File

@ -77,7 +77,7 @@ class MemcachedDriver(base.Driver):
if updated_time_in_mc:
# Change mc time to offset-aware time
updated_time_in_mc = \
updated_time_in_mc.replace(tzinfo=iso8601.iso8601.Utc())
updated_time_in_mc.replace(tzinfo=iso8601.UTC)
if updated_time_in_db <= updated_time_in_mc:
return updated_time_in_mc

View File

@ -40,7 +40,7 @@ import nova.utils
CONF = cfg.CONF
FAKE_NETWORK_PROJECT_ID = '6133f8b603924f45bc0c9e21f6df12fa'
UTC = iso8601.iso8601.Utc()
UTC = iso8601.UTC
FAKE_NETWORKS = [
{
'bridge': 'br100', 'vpn_public_port': 1000,

View File

@ -1180,7 +1180,7 @@ class ServicesCellsTestV21(test.TestCase):
def test_services_detail(self):
req = FakeRequest()
res_dict = self.controller.index(req)
utc = iso8601.iso8601.Utc()
utc = iso8601.UTC
response = {'services': [
{'id': 'cell1@1',
'binary': 'nova-scheduler',

View File

@ -891,7 +891,7 @@ class _ComputeAPIUnitTestMixIn(object):
'cores': -inst.flavor.vcpus,
'ram': -inst.flavor.memory_mb}
delete_time = datetime.datetime(1955, 11, 5, 9, 30,
tzinfo=iso8601.iso8601.Utc())
tzinfo=iso8601.UTC)
self.useFixture(utils_fixture.TimeFixture(delete_time))
task_state = (delete_type == 'soft_delete' and
task_states.SOFT_DELETING or task_states.DELETING)
@ -1096,7 +1096,7 @@ class _ComputeAPIUnitTestMixIn(object):
inst, 'delete.start')
db.constraint(host=mox.IgnoreArg()).AndReturn('constraint')
delete_time = datetime.datetime(1955, 11, 5, 9, 30,
tzinfo=iso8601.iso8601.Utc())
tzinfo=iso8601.UTC)
updates['deleted_at'] = delete_time
updates['deleted'] = True
fake_inst = fake_instance.fake_db_instance(**updates)

View File

@ -1052,8 +1052,8 @@ class SqlAlchemyDbApiNoDbTestCase(test.NoDBTestCase):
t2 = t1 + datetime.timedelta(seconds=10)
t3 = t2 + datetime.timedelta(hours=1)
t2_utc = t2.replace(tzinfo=iso8601.iso8601.Utc())
t3_utc = t3.replace(tzinfo=iso8601.iso8601.Utc())
t2_utc = t2.replace(tzinfo=iso8601.UTC)
t3_utc = t3.replace(tzinfo=iso8601.UTC)
datetime_keys = ('created_at', 'deleted_at')
@ -2374,7 +2374,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
dt_keys = ('created_at', 'deleted_at', 'updated_at',
'launched_at', 'terminated_at')
dt = timeutils.utcnow()
dt_utc = dt.replace(tzinfo=iso8601.iso8601.Utc())
dt_utc = dt.replace(tzinfo=iso8601.UTC)
for key in dt_keys:
values[key] = dt_utc
inst = db.instance_create(self.ctxt, values)
@ -2391,7 +2391,7 @@ class InstanceTestCase(test.TestCase, ModelsObjectComparatorMixin):
dt_keys = ('created_at', 'deleted_at', 'updated_at',
'launched_at', 'terminated_at')
dt = timeutils.utcnow()
dt_utc = dt.replace(tzinfo=iso8601.iso8601.Utc())
dt_utc = dt.replace(tzinfo=iso8601.UTC)
for key in dt_keys:
values[key] = dt_utc
inst = db.instance_create(self.ctxt, {})

View File

@ -69,7 +69,7 @@ class _TestBandwidthUsage(test.TestCase):
@staticmethod
def _time_now_and_start_period():
now = timeutils.utcnow().replace(tzinfo=iso8601.iso8601.Utc(),
now = timeutils.utcnow().replace(tzinfo=iso8601.UTC,
microsecond=0)
start_period = now - datetime.timedelta(seconds=10)
return now, start_period

View File

@ -400,7 +400,7 @@ class TestBoolean(TestField):
class TestDateTime(TestField):
def setUp(self):
super(TestDateTime, self).setUp()
self.dt = datetime.datetime(1955, 11, 5, tzinfo=iso8601.iso8601.Utc())
self.dt = datetime.datetime(1955, 11, 5, tzinfo=iso8601.UTC)
self.field = fields.DateTimeField()
self.coerce_good_values = [(self.dt, self.dt),
(utils.isotime(self.dt), self.dt)]
@ -413,7 +413,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=iso8601.UTC)))
class TestDict(TestField):

View File

@ -213,7 +213,7 @@ class _TestFixedIPObject(object):
now = timeutils.utcnow()
now_tz = timeutils.parse_isotime(
utils.isotime(now)).replace(
tzinfo=iso8601.iso8601.Utc())
tzinfo=iso8601.UTC)
disassociate.return_value = 123
result = fixed_ip.FixedIP.disassociate_all_by_timeout(self.context,
'host', now)

View File

@ -71,9 +71,9 @@ class _TestTaskLog(object):
self.context,
fake_task_log['task_name'],
fake_task_log['period_beginning'].replace(
tzinfo=iso8601.iso8601.Utc()),
tzinfo=iso8601.UTC),
fake_task_log['period_ending'].replace(
tzinfo=iso8601.iso8601.Utc()),
tzinfo=iso8601.UTC),
fake_task_log['host'],
task_items=fake_task_log['task_items'],
message=fake_task_log['message'])
@ -92,9 +92,9 @@ class _TestTaskLog(object):
self.context,
fake_task_log['task_name'],
fake_task_log['period_beginning'].replace(
tzinfo=iso8601.iso8601.Utc()),
tzinfo=iso8601.UTC),
fake_task_log['period_ending'].replace(
tzinfo=iso8601.iso8601.Utc()),
tzinfo=iso8601.UTC),
fake_task_log['host'],
errors=fake_task_log['errors'],
message=fake_task_log['message'])

View File

@ -71,7 +71,7 @@ class MemcachedServiceGroupTestCase(test.NoDBTestCase):
service_ref = {
'host': 'fake-host',
'topic': 'compute',
'updated_at': updated_at_time.replace(tzinfo=iso8601.iso8601.Utc())
'updated_at': updated_at_time.replace(tzinfo=iso8601.UTC)
}
self.mc_client.get.return_value = None
@ -81,12 +81,12 @@ class MemcachedServiceGroupTestCase(test.NoDBTestCase):
self.mc_client.reset_mock()
retval = timeutils.utcnow()
self.mc_client.get.return_value = retval
self.assertEqual(retval.replace(tzinfo=iso8601.iso8601.Utc()),
self.assertEqual(retval.replace(tzinfo=iso8601.UTC),
self.servicegroup_api.get_updated_time(service_ref))
self.mc_client.get.assert_called_once_with('compute:fake-host')
self.mc_client.reset_mock()
service_ref['updated_at'] = \
retval.replace(tzinfo=iso8601.iso8601.Utc())
retval.replace(tzinfo=iso8601.UTC)
self.mc_client.get.return_value = updated_at_time
self.assertEqual(service_ref['updated_at'],
self.servicegroup_api.get_updated_time(service_ref))