Fix unit tests to work with stevedore > 2.0.1
stevedore has switched to importlib_metadata[1] and this breaked unit test as the test relied on internal implementation of it. Instead we should switch to mock NamedExtensionManager that's what called by oslo_config. [1] https://review.opendev.org/#/c/739306/ Closes-Bug: #1888208 Change-Id: Ic4b990a387d875a351c9f8e7eaaef726734ff305
This commit is contained in:
parent
392922aa33
commit
a2652b3584
@ -1652,8 +1652,8 @@ class GeneratorRaiseErrorTestCase(base.BaseTestCase):
|
||||
self.conf = cfg.ConfigOpts()
|
||||
self.conf.register_opts(generator._generator_opts)
|
||||
self.conf.set_default('namespace', [fake_ep.name])
|
||||
fake_eps = mock.Mock(return_value=[fake_ep])
|
||||
with mock.patch('pkg_resources.iter_entry_points', fake_eps):
|
||||
with mock.patch('stevedore.named.NamedExtensionManager',
|
||||
side_effect=FakeException()):
|
||||
self.assertRaises(FakeException, generator.generate, self.conf)
|
||||
|
||||
def test_generator_call_with_no_arguments_raises_system_exit(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user