Replace datetime.datetime.utcnow()
... because it was deprecated in Python 3.12. Change-Id: I4b5fc30e68f7d8f0ecde8b1c684ae42392c0550c
This commit is contained in:
parent
8d920ce880
commit
ae78c7edf9
@ -13,7 +13,6 @@
|
||||
|
||||
import collections
|
||||
import contextlib
|
||||
import datetime as dt
|
||||
import itertools
|
||||
import pydoc
|
||||
import re
|
||||
@ -24,6 +23,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import reflection
|
||||
from oslo_utils import timeutils as oslo_timeutils
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
@ -58,8 +58,6 @@ cfg.CONF.import_opt('error_wait_time', 'heat.common.config')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
datetime = dt.datetime
|
||||
|
||||
|
||||
def _register_class(resource_type, resource_class):
|
||||
resources.global_env().register_class(resource_type, resource_class)
|
||||
@ -1675,7 +1673,7 @@ class Resource(status.ResourceStatus):
|
||||
|
||||
LOG.info('updating %s', self)
|
||||
|
||||
self.updated_time = datetime.utcnow()
|
||||
self.updated_time = oslo_timeutils.utcnow()
|
||||
|
||||
if new_requires is not None:
|
||||
self.requires = self.requires | new_requires
|
||||
|
@ -604,7 +604,7 @@ class WaitConditionUpdateTest(common.HeatTestCase):
|
||||
|
||||
now = timeutils.utcnow()
|
||||
fake_clock = [now + datetime.timedelta(0, t)
|
||||
for t in (0, 0.001, 0.1, 4.1, 5.1)]
|
||||
for t in (0, 0, 0.001, 0.1, 4.1, 5.1, 5.1)]
|
||||
timeutils.set_time_override(fake_clock)
|
||||
self.addCleanup(timeutils.clear_time_override)
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import datetime
|
||||
import itertools
|
||||
import json
|
||||
import os
|
||||
@ -22,6 +21,7 @@ import uuid
|
||||
|
||||
import eventlet
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils as oslo_timeutils
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
@ -600,7 +600,7 @@ class ResourceTest(common.HeatTestCase):
|
||||
res = generic_rsrc.GenericResource('test_resource', tmpl, self.stack)
|
||||
res.store()
|
||||
self.assertIsNone(res.updated_time)
|
||||
res.updated_time = datetime.datetime.utcnow()
|
||||
res.updated_time = oslo_timeutils.utcnow()
|
||||
res.store()
|
||||
self.assertIsNotNone(res.updated_time)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user