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_policy.

[1] https://review.opendev.org/#/c/739306/

Closes-Bug: #1888208
Change-Id: I993d743c53fa3506ceda3d1f291c12f4635eb60a
tags/3.3.2^0
yatinkarel 3 weeks ago
parent
commit
6296fce9f8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      oslo_policy/tests/test_generator.py

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

@@ -492,8 +492,8 @@ class GeneratorRaiseErrorTestCase(testtools.TestCase):
raise FakeException()

fake_ep = FakeEP()
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_sample,
fake_ep.name)



Loading…
Cancel
Save