[UT] Change number of `utcnow
call number in
test_update_timpestamp
`
Since [1], the method ``timeutils.utcnow`` is called from ``neutron_lib.context.ContextBase.__init__`` too. Although this patch is still not released (current last neutron-lib version is 3.10.0), this is affecting "openstack-tox-py311-with-sqlalchemy-master" that is using neutron-lib master branch. [1]https://review.opendev.org/c/openstack/neutron-lib/+/903841 Closes-Bug: #2051501 Change-Id: I1b2dd06d12dffd95869508167f8682e4042c044e
This commit is contained in:
parent
7e6ac2792e
commit
c6ac441a51
@ -267,14 +267,23 @@ class TimeStampDBMixinTestCase(TimeStampChangedsinceTestCase):
|
||||
self._network.delete()
|
||||
timenow.reset_mock()
|
||||
self._network = self._save_network(network_id)
|
||||
return 1 == timenow.call_count
|
||||
# NOTE(ralonsoh): ``timeutils.utcnow()`` is called from the tested
|
||||
# method ``neutron.service.timestamp.timestamp_db._add_timestamp``
|
||||
# and ``neutron_lib.context.ContextBase.__init__``.
|
||||
# TODO(ralonsoh): change to "return 2 == timenow.call_count" when
|
||||
# neutron-lib > 3.10.0
|
||||
return timenow.call_count in (2, 1)
|
||||
|
||||
def save_tag():
|
||||
for tag in self._tags:
|
||||
tag.delete()
|
||||
timenow.reset_mock()
|
||||
self._tags = self._save_tag(tags, self._network.standard_attr_id)
|
||||
return 0 == timenow.call_count
|
||||
# NOTE(ralonsoh): ``timeutils.utcnow()`` is called from
|
||||
# ``neutron_lib.context.ContextBase.__init__``.
|
||||
# TODO(ralonsoh): change to "return 1 == timenow.call_count" when
|
||||
# neutron-lib > 3.10.0
|
||||
return timenow.call_count in (1, 0)
|
||||
|
||||
network_id = uuidutils.generate_uuid()
|
||||
tags = ["red", "blue"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user