I have a base contract class which can be inherited to provide plugin functionality. I'm adding the new plugins using setuptools entrypoints something like
entry_points="""
[plugins]
plugin1=plugins.plugin1:Plugin1
"""
And classes look like...
class Plugin:
__metaclass__ = abc.ABCMeta
@abstractmethod
def must_override_method():
pass
@abstractmethod
def must_override_method2():
pass
#./plugins/plugin1.py
#Actually the plugins could be anywhere
class Plugin1(Plugin):
def must_override_method():
print("Hello")
Although the @abstracmethod doesn't let me instantiate the class at runtime if must_override_methods are not defined but how should I go about adding unit tests for the plugins that are not yet written.
Is there a simple way to write generic test that catches "plugins" that don't implement abstract methods while testing?