Browse Source

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
tags/8.3.1^0
yatinkarel 1 week ago
parent
commit
a2652b3584
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      oslo_config/tests/test_generator.py

+ 2
- 2
oslo_config/tests/test_generator.py View File

@@ -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…
Cancel
Save