def test_discovery(): """ Tests that this plugin can be discovered via the plugins subsystem when looking for Sweeper :return: """ assert RangeSweeper.__name__ in [ x.__name__ for x in Plugins.discover(Sweeper) ]
def test_discovery() -> None: """ Tests that this plugin can be discovered via the plugins subsystem when looking for Launchers :return: """ assert ExampleLauncher.__name__ in [ x.__name__ for x in Plugins.discover(Launcher) ]
def test_discovery() -> None: # This may seem weird, but it verifies that we can discover this Plugin via # the plugins subsystem. # The discover method takes a class and return all plugins that implements that class. # Typically we would be discovering all plugins that implementing some common interface. plugins = Plugins.discover(ExamplePlugin) # discovered plugins are actually different class objects, compare by name assert ExamplePlugin.__name__ in [x.__name__ for x in plugins]
def test_discover(plugin_type, expected): plugins = Plugins.discover(plugin_type) expected_classes = [get_class(c) for c in sorted(expected)] for ex in expected_classes: assert ex in plugins
def test_discover(plugin_type: Type[Plugin], expected: List[str]) -> None: plugins = Plugins.discover(plugin_type) expected_classes = [get_class(c) for c in sorted(expected)] for ex in expected_classes: assert ex in plugins