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

@ -30,10 +30,10 @@ class TestRouterosApiModule(ModuleTestCase):
def setUp(self):
super(TestRouterosApiModule, self).setUp()
librouteros = pytest.importorskip("librouteros")
self.module = api
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.create_api', MagicMock(new=fake_ros_api))
self.patch_create_api.start()
self.module.Key = MagicMock(new=Key)