コード例 #1
0
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        # dependency manager will live in the temp folder
        # so we can keep it unmocked.
        CoreServices.register_service(
            ServiceName.DEPENDENCY_MANAGER,
            PluginDependencyManager(os.path.join(lp_file.dirname, ".library")))
        CoreServices.register_service(
            ServiceName.PLUGINS_MANAGER,
            InfraredPluginManager(lp_file.strpath,
                                  CoreServices.dependency_manager(),
                                  os.path.join(lp_file.dirname, "plugins")))
        return CoreServices.plugins_manager()
コード例 #2
0
ファイル: test_plugins.py プロジェクト: dprince/infrared
    def plugin_manager_helper(plugins_conf_dict=None):

        if plugins_conf_dict is None:
            plugins_conf_dict = {}

        plugins_conf_dict.update(SUPPORTED_TYPES_DICT)

        with lp_file.open(mode='w') as fp:
            config = ConfigParser.ConfigParser()
            for section, section_data in plugins_conf_dict.items():
                config.add_section(section)
                for option, value in section_data.items():
                    config.set(section, option, value)
            config.write(fp)

        # replace core service with or test service
        CoreServices.register_service(ServiceName.PLUGINS_MANAGER,
                                      InfraredPluginManager(lp_file.strpath))
        return CoreServices.plugins_manager()