diff options
author | yatinkarel <ykarel@redhat.com> | 2020-07-23 11:05:05 +0530 |
---|---|---|
committer | yatinkarel <ykarel@redhat.com> | 2020-07-23 11:06:29 +0530 |
commit | a2652b3584da06e4c4ebe96261672309b01c1122 (patch) | |
tree | fc694f8b1c2fee7953166f2428d64082b15e2771 | |
parent | 392922aa333f9777f98e7ce61ad46f69cd9ac455 (diff) | |
download | oslo-config-a2652b3584da06e4c4ebe96261672309b01c1122.tar.gz |
Fix unit tests to work with stevedore > 2.0.18.3.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
-rw-r--r-- | oslo_config/tests/test_generator.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/oslo_config/tests/test_generator.py b/oslo_config/tests/test_generator.py index 7cb354e..a069e24 100644 --- a/oslo_config/tests/test_generator.py +++ b/oslo_config/tests/test_generator.py @@ -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): |