summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryatinkarel <ykarel@redhat.com>2020-07-21 09:55:42 +0530
committeryatinkarel <ykarel@redhat.com>2020-07-22 12:14:24 +0530
commit6296fce9f8e3205506f87dd31d0b18f4b7842000 (patch)
treee7d85249648100e55e8a259415390c55c805d108
parentcab28649c689067970a51a2f9b329bdd6a0f0501 (diff)
downloadoslo-policy-6296fce9f8e3205506f87dd31d0b18f4b7842000.tar.gz
Fix unit tests to work with stevedore > 2.0.13.3.2
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
-rw-r--r--oslo_policy/tests/test_generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/oslo_policy/tests/test_generator.py b/oslo_policy/tests/test_generator.py
index af6398f..1f74aa3 100644
--- a/oslo_policy/tests/test_generator.py
+++ b/oslo_policy/tests/test_generator.py
@@ -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)