Improve unit test performance. (Do not install library we do not use in the tests anyway.) (#92)

This commit is contained in:
Felix Fontein 2022-05-15 22:42:26 +02:00 committed by GitHub
parent ea782c1cf2
commit 5f912dad16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 19 deletions

View file

@ -424,10 +424,10 @@ class TestRouterosApiFactsModule(ModuleTestCase):
def setUp(self):
super(TestRouterosApiFactsModule, self).setUp()
librouteros = pytest.importorskip('librouteros')
self.module = api_facts
self.module.LibRouterosError = FakeLibRouterosError
self.module.connect = MagicMock(new=fake_ros_api)
self.module.check_has_library = MagicMock()
self.patch_create_api = patch('ansible_collections.community.routeros.plugins.modules.api_facts.create_api', MagicMock(new=fake_ros_api))
self.patch_create_api.start()
self.patch_query_path = patch('ansible_collections.community.routeros.plugins.modules.api_facts.FactsBase.query_path', self.query_path)