def dynamic_load_library(self, a_plugin_info): """Dynamically load the plugin info if not loaded Parameters -------------- a_plugin_info: a instance of plugin info """ if a_plugin_info.cls is None: self._logger.debug("import " + a_plugin_info.absolute_import_path) cls = do_import_class(a_plugin_info.absolute_import_path) a_plugin_info.cls = cls return a_plugin_info.cls
def test_do_import_cls(): from lml.utils import do_import_class manager = do_import_class("lml.plugin.PluginManager") eq_(manager, PluginManager)
def test_do_import_cls(): from lml.utils import do_import_class manager = do_import_class("lml.plugin.PluginManager") assert manager == PluginManager