<s> from giblets import ExtensionInterface <EOL> class TestPathInterface ( ExtensionInterface ) : <EOL> pass <EOL> class TestEggInterface ( ExtensionInterface ) : <EOL> pass <EOL> def test_load_from_path ( ) : <EOL> from giblets . core import ComponentManager , Component , ExtensionPoint <EOL> from giblets . search import find_plugins_in_path <EOL> class PluginFinder ( Component ) : <EOL> found_plugins = ExtensionPoint ( TestPathInterface ) <EOL> mgr = ComponentManager ( ) <EOL> pf = PluginFinder ( mgr ) <EOL> assert len ( pf . found_plugins ) == <NUM_LIT:0> <EOL> find_plugins_in_path ( '<STR_LIT>' ) <EOL> expected_plugins = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> got_plugins = set ( ) <EOL> assert len ( pf . found_plugins ) == len ( expected_plugins ) <EOL> for plugin in pf . found_plugins : <EOL> plugin_name = plugin . __class__ . __name__ <EOL> assert plugin_name in expected_plugins <EOL> got_plugins . add ( plugin_name ) <EOL> for plugin_name in expected_plugins : <EOL> assert plugin_name in got_plugins <EOL> def test_load_from_entry_point ( ) : <EOL> from giblets . core import ComponentManager , Component , ExtensionPoint <EOL> from giblets . search import find_plugins_by_entry_point <EOL> class PluginFinder ( Component ) : <EOL> found_plugins = ExtensionPoint ( TestEggInterface ) <EOL> mgr = ComponentManager ( ) <EOL> pf = PluginFinder ( mgr ) <EOL> assert len ( pf . found_plugins ) == <NUM_LIT:0> <EOL> find_plugins_by_entry_point ( '<STR_LIT>' ) <EOL> expected_plugins = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> got_plugins = set ( ) <EOL> assert len ( pf . found_plugins ) == len ( expected_plugins ) <EOL> for plugin in pf . found_plugins : <EOL> plugin_name = plugin . __class__ . __name__ <EOL> assert plugin_name in expected_plugins <EOL> got_plugins . add ( plugin_name ) <EOL> for plugin_name in expected_plugins : <EOL> assert plugin_name in got_plugins </s>
