From e91576644964b60d029e5f64e49e9c0de2139cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 26 Sep 2023 19:55:41 +0200 Subject: [PATCH] ignore uninitialized plugin tests when strict=false --- senpy/plugins/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/senpy/plugins/__init__.py b/senpy/plugins/__init__.py index d78c97a..42307b4 100644 --- a/senpy/plugins/__init__.py +++ b/senpy/plugins/__init__.py @@ -311,10 +311,18 @@ class FailedPlugin(Plugin): a = info.get('name', info.get('module', self.name)) self['name'] == a self._function = function + self.is_activated = False def retry(self): return self._function() + def test(self): + ''' + A module that failed to load cannot be tested. But non-optional + plugins should not fail to load in strict mode. + ''' + assert self.optional and not config.strict + class Analyser(Plugin): '''