def test_load_from_entry_point(): from giblets.core import ComponentManager, Component, ExtensionPoint from giblets.search import find_plugins_by_entry_point class PluginFinder(Component): found_plugins = ExtensionPoint(TestEggInterface) mgr = ComponentManager() pf = PluginFinder(mgr) # to start with, nothing should be found assert len(pf.found_plugins) == 0 find_plugins_by_entry_point("giblets_load_from_entry_point_test") expected_plugins = ["TestEggPlugin1", "TestEggPlugin2", "TestEggPlugin3"] got_plugins = set() assert len(pf.found_plugins) == len(expected_plugins) for plugin in pf.found_plugins: plugin_name = plugin.__class__.__name__ assert plugin_name in expected_plugins got_plugins.add(plugin_name) for plugin_name in expected_plugins: assert plugin_name in got_plugins
def __init__(self, config): self.config = dibjectify(config) self._local = green_local() find_plugins_by_entry_point(MELKMAN_PLUGIN_ENTRY_POINT) self._broker = None