Mock 'oslo_messaging.notify._impl_routing.LOG' in notifier tests
When running the tests with concurrency=1, 2 tests fail with: AttributeError: Mock object has no attribute 'debug' and AssertionError: Expected 'notify' to be called once. Called 0 times Mocking the LOG object solves the problem. Change-Id: Ie7f4448a103fae448123a05bc92e961aac00d6ec Closes-Bug: #1660393
This commit is contained in:
parent
e1f718d53a
commit
f0b4baa707
@ -441,6 +441,8 @@ group_2:
|
|||||||
with mock.patch('stevedore.dispatch.DispatchExtensionManager',
|
with mock.patch('stevedore.dispatch.DispatchExtensionManager',
|
||||||
return_value=self._fake_extension_manager(
|
return_value=self._fake_extension_manager(
|
||||||
mock.MagicMock())):
|
mock.MagicMock())):
|
||||||
|
with mock.patch('oslo_messaging.notify.'
|
||||||
|
'_impl_routing.LOG'):
|
||||||
self.router._load_notifiers()
|
self.router._load_notifiers()
|
||||||
groups = list(self.router.routing_groups.keys())
|
groups = list(self.router.routing_groups.keys())
|
||||||
groups.sort()
|
groups.sort()
|
||||||
@ -593,6 +595,9 @@ group_1:
|
|||||||
config_file):
|
config_file):
|
||||||
with mock.patch('stevedore.dispatch.DispatchExtensionManager',
|
with mock.patch('stevedore.dispatch.DispatchExtensionManager',
|
||||||
return_value=pm):
|
return_value=pm):
|
||||||
|
with mock.patch('oslo_messaging.notify.'
|
||||||
|
'_impl_routing.LOG'):
|
||||||
|
|
||||||
self.notifier.info({}, 'my_event', {})
|
self.notifier.info({}, 'my_event', {})
|
||||||
self.assertFalse(bar_driver.info.called)
|
self.assertFalse(bar_driver.info.called)
|
||||||
rpc_driver.notify.assert_called_once_with(
|
rpc_driver.notify.assert_called_once_with(
|
||||||
|
Loading…
Reference in New Issue
Block a user