当前位置: 首页>>代码示例>>Python>>正文


Python PluginContainer.get_broken_plugins方法代码示例

本文整理汇总了Python中invenio.pluginutils.PluginContainer.get_broken_plugins方法的典型用法代码示例。如果您正苦于以下问题:Python PluginContainer.get_broken_plugins方法的具体用法?Python PluginContainer.get_broken_plugins怎么用?Python PluginContainer.get_broken_plugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在invenio.pluginutils.PluginContainer的用法示例。


在下文中一共展示了PluginContainer.get_broken_plugins方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_plugin_container_wrapping_websubmit_functions

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    def test_plugin_container_wrapping_websubmit_functions(self):
        """pluginutils - wrapping websubmit functions"""
        websubmit_functions = PluginContainer(os.path.join(CFG_PYLIBDIR, 'invenio', 'websubmit_functions', '*.py'))

        self.failUnless(websubmit_functions['Is_Referee'])
        self.failUnless(websubmit_functions['CaseEDS'])
        self.failUnless(callable(websubmit_functions['CaseEDS']))
        self.failUnless(len(websubmit_functions) >= 62)
        ## Retrieve_Data and Shared_Functions are not real plugins
        self.failUnless(len(websubmit_functions.get_broken_plugins()) >= 2)
        self.failIf(websubmit_functions.get('Shared_Functions'))
        self.failUnless('Shared_Functions' in websubmit_functions.get_broken_plugins())
开发者ID:metandrey,项目名称:invenio-metandrey,代码行数:14,代码来源:pluginutils_tests.py

示例2: test_plugin_container_wrapping_websubmit_functions

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    def test_plugin_container_wrapping_websubmit_functions(self):
        """pluginutils - wrapping websubmit functions"""
        websubmit_functions = PluginContainer(os.path.join(CFG_PYLIBDIR, "invenio", "websubmit_functions", "*.py"))

        self.failUnless(websubmit_functions["Is_Referee"])
        self.failUnless(websubmit_functions["CaseEDS"])
        self.failUnless(callable(websubmit_functions["CaseEDS"]))
        self.failUnless(
            len(websubmit_functions) >= 62,
            "There should exist at least 62 websubmit_functions. Found: %s" % len(websubmit_functions),
        )
        ## Retrieve_Data and Shared_Functions are not real plugins
        self.failUnless(len(websubmit_functions.get_broken_plugins()) >= 2)
        self.failIf(websubmit_functions.get("Shared_Functions"))
        self.failUnless("Shared_Functions" in websubmit_functions.get_broken_plugins())
开发者ID:adsabs,项目名称:invenio,代码行数:17,代码来源:pluginutils_unit_tests.py

示例3: build_and_run_web_test_suite

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def build_and_run_web_test_suite():
    """Build and run the web tests.

    Detect all Invenio modules with names ending by
    '*_web_tests.py', build a complete test suite of them, and
    run it.  Called by 'inveniocfg --run-web-tests'.
    """
    from invenio.config import CFG_PYLIBDIR
    from invenio.pluginutils import PluginContainer
    test_modules_map = PluginContainer(
        os.path.join(CFG_PYLIBDIR, 'invenio', '*_web_tests.py'),
        lambda plugin_name, plugin_code: getattr(plugin_code, "TEST_SUITE"))
    test_modules = test_modules_map.values()

    broken_tests = test_modules_map.get_broken_plugins()

    broken_web_tests = ['%s (reason: %s)' % (name, broken_tests[name][1])
                        for name in broken_tests]
    if broken_web_tests:
        warn("Broken web tests suites found: %s" % ', '.join(broken_web_tests))

    warn_user_about_tests()

    complete_suite = unittest.TestSuite(test_modules)
    runner = unittest.TextTestRunner(descriptions=False, verbosity=2)
    return runner.run(complete_suite).wasSuccessful()
开发者ID:rosenthalo,项目名称:invenio,代码行数:28,代码来源:__init__.py

示例4: load_ticket_plugins

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def load_ticket_plugins():
    """
    Will load all the ticket plugins found under CFG_BIBCATALOG_PLUGIN_DIR.

    Returns a tuple of plugin_object, list of errors.
    """
    # TODO add to configfile
    CFG_BIBCATALOG_PLUGIN_DIR = os.path.join(CFG_PYLIBDIR,
                                             "invenio",
                                             "bibcatalog_ticket_templates",
                                             "*.py")
    # Load plugins
    plugins = PluginContainer(CFG_BIBCATALOG_PLUGIN_DIR,
                              plugin_builder=_bibcatalog_plugin_builder)

    # Remove __init__ if applicable
    try:
        plugins.disable_plugin("__init__")
    except KeyError:
        pass

    error_messages = []
    # Check for broken plug-ins
    broken = plugins.get_broken_plugins()
    if broken:
        error_messages = []
        for plugin, info in broken.items():
            error_messages.append("Failed to load %s:\n"
                                  " %s" % (plugin, "".join(traceback.format_exception(*info))))
    return plugins, error_messages
开发者ID:osub3,项目名称:invenio,代码行数:32,代码来源:task.py

示例5: load_bfe_elements

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def load_bfe_elements():
    BFE_ELEMENTS = PluginContainer(os.path.join(CFG_PYLIBDIR, 'invenio',
                                                'bibformat_elements',
                                                'bfe_*.py'),
                                   plugin_builder=plugin_builder)

    ## Let's report about broken plugins
    open(os.path.join(CFG_LOGDIR, 'broken-bibformat-elements.log'), 'w').write(
        pformat(BFE_ELEMENTS.get_broken_plugins()))

    current_app.config['BFE_ELEMENTS'] = BFE_ELEMENTS
开发者ID:peskk3am,项目名称:b2share,代码行数:13,代码来源:websearch_blueprint.py

示例6: test_no_broken_search_services_

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    def test_no_broken_search_services_(self):
        """websearch - no broken search services"""
        error_messages = []
        search_service_plugins = PluginContainer(os.path.join(CFG_SEARCH_SERVICES_PATH, '*Service.py'),
                                                 api_version=__required_plugin_API_version__,
                                                 plugin_signature=SearchService)
        for name, error in search_service_plugins.get_broken_plugins().iteritems():
            error_messages.append("Service '%s' could not be loaded:\n%s" % \
                                  (name, repr(error[0]) + " " + repr(error[1]) + "\n" + "\n".join(traceback.format_tb(error[2]))))

        if error_messages:
            self.fail(merge_error_messages(error_messages))
开发者ID:BessemAamira,项目名称:invenio,代码行数:14,代码来源:websearch_services_regression_tests.py

示例7: test_plugin_container_wrapping_external_authentications

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    def test_plugin_container_wrapping_external_authentications(self):
        """pluginutils - wrapping external authentications"""
        def plugin_builder(plugin_name, plugin_code):
            for name in dir(plugin_code):
                candidate = getattr(plugin_code, name)
                try:
                    if issubclass(candidate, ExternalAuth):
                        return candidate
                except TypeError:
                    pass
            raise ValueError('%s is not a valid external authentication plugin' % plugin_name)

        external_authentications = PluginContainer(os.path.join(CFG_PYLIBDIR, 'invenio', 'external_authentication_*.py'), plugin_signature=ExternalAuth, plugin_builder=plugin_builder)
        self.failUnless(issubclass(external_authentications['external_authentication_sso'], ExternalAuth))
        self.failIf(external_authentications.get('external_authentication_cern_wrapper'))
        self.failUnless(len(external_authentications) >= 1)
        self.failUnless(len(external_authentications.get_broken_plugins()) >= 2)
开发者ID:metandrey,项目名称:invenio-metandrey,代码行数:19,代码来源:pluginutils_tests.py

示例8: load_plugins

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def load_plugins():
    """
    Will load all the plugins found under the bibcheck_plugins folder.

    Returns a list of plugin objects.
    """
    plugin_dir = os.path.join(CFG_PYLIBDIR, "invenio/bibcheck_plugins/*.py")

    # Load plugins
    plugins = PluginContainer(plugin_dir,
                              plugin_builder=_bibcheck_plugin_builder)

    # Check for broken plug-ins
    broken = plugins.get_broken_plugins()
    if broken:
        for plugin, info in broken.items():
            print "Failed to load %s:\n" % plugin
            print "".join(traceback.format_exception(*info))
    enabled = plugins.get_enabled_plugins()
    enabled.pop("__init__", None)
    return enabled
开发者ID:kaplun,项目名称:invenio,代码行数:23,代码来源:bibcheck_task.py

示例9: build_and_run_unit_test_suite

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def build_and_run_unit_test_suite():
    """
    Detect all Invenio modules with names ending by '*_unit_tests.py', build
    a complete test suite of them, and run it.
    Called by 'inveniocfg --run-unit-tests'.
    """

    test_modules_map = PluginContainer(
        os.path.join(CFG_PYLIBDIR, 'invenio', '*_unit_tests.py'),
        lambda plugin_name, plugin_code: getattr(plugin_code, "TEST_SUITE"))
    test_modules = [test_modules_map[name] for name in test_modules_map]

    broken_tests = test_modules_map.get_broken_plugins()

    broken_unit_tests = ['%s (reason: %s)' % (name, broken_tests[name][1]) for name in broken_tests]
    if broken_unit_tests:
        warn("Broken unit tests suites found: %s" % ', '.join(broken_unit_tests))

    complete_suite = unittest.TestSuite(test_modules)
    res = unittest.TextTestRunner(verbosity=2).run(complete_suite)
    return res.wasSuccessful()
开发者ID:aw-bib,项目名称:tind-invenio,代码行数:23,代码来源:testutils.py

示例10: metadata_info

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
def metadata_info(verbose=0):
    """Shows information about the available plugins"""
    print 'Plugin APIs version: %s' % str(__required_plugin_API_version__)

    # Plugins
    print 'Available plugins:'
    metadata_extractor_plugins = PluginContainer(
        os.path.join(CFG_PYLIBDIR,
                     'invenio', 'websubmit_file_metadata_plugins', 'wsm_*.py'),
        plugin_builder=plugin_builder_function,
        api_version=__required_plugin_API_version__
        )

    # Print each operation on each plugin
    for plugin_name, plugin_funcs in metadata_extractor_plugins.iteritems():
        if len(plugin_funcs) > 0:
            print '-- Name: ' + plugin_name
            print '   Supported operation%s: ' % \
                  (len(plugin_funcs) > 1 and 's' or '') + \
                  ', '.join(plugin_funcs)

    # Are there any unloaded plugins?
    broken_plugins = metadata_extractor_plugins.get_broken_plugins()
    if len(broken_plugins.keys()) > 0:
        print 'Could not load the following plugin%s:' % \
              (len(broken_plugins.keys()) > 1 and 's' or '')
        for broken_plugin_name, broken_plugin_trace_info in broken_plugins.iteritems():
            print '-- Name: ' + broken_plugin_name
            if verbose > 5:
                formatted_traceback = \
                                    traceback.format_exception(broken_plugin_trace_info[0],
                                                               broken_plugin_trace_info[1],
                                                               broken_plugin_trace_info[2])
                print '    ' + ''.join(formatted_traceback).replace('\n', '\n    ')
            elif verbose > 0:
                print '    ' + str(broken_plugin_trace_info[1])
开发者ID:aw-bib,项目名称:tind-invenio,代码行数:38,代码来源:websubmit_file_metadata.py

示例11: plugin

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    parser.add_option_group(redirection_group)

    specific_group = optparse.OptionGroup(parser, "Specific Options")
    specific_group.add_option("-P", "--plugin", metavar="PLUGIN", action="store", dest="plugin", help="Specify the plugin to use when registering or updating a redirection")
    specific_group.add_option("-j", "--json-parameters", metavar="PARAMETERS", action="callback", type="string", callback=get_json_parameters_from_cli, help="Specify the parameters to provide to the plugin (serialized in JSON)")
    specific_group.add_option("-p", "--parameter", metavar="PARAM=VALUE", action="callback", callback=get_parameter_from_cli, help="Specify a single PARAM=VALUE parameter to be provided to the plugin (alternative to the JSON serialization)", type="string")
    parser.add_option_group(specific_group)

    (options, dummy_args) = parser.parse_args()
    if options.action == "list-goto-plugins":
        print "GOTO plugins found:"
        for component, goto in CFG_GOTO_PLUGINS.items():
            print component + ' -> ' + get_callable_documentation(goto)
    elif options.action == 'list-broken-goto-plugins':
        print "Broken GOTO plugins found:"
        for component, error in CFG_GOTO_PLUGINS.get_broken_plugins().items():
            print component + '->' + str(error)
    elif options.register:
        label = options.register
        plugin = options.plugin
        parameters = getattr(options, 'parameters', {})
        if not plugin in CFG_GOTO_PLUGINS:
            parser.error("%s is not a valid plugin" % plugin)
        if is_redirection_label_already_taken(label):
            parser.error("The specified label %s is already taken" % label)
        register_redirection(label, plugin, parameters)
        print "The redirection %s was successfully registered for the plugin %s with parameters %s" % (label, plugin, parameters)
    elif options.update:
        label = options.update
        if not is_redirection_label_already_taken(label):
            parser.error("The specified label %s does not exist" % label)
开发者ID:aw-bib,项目名称:tind-invenio,代码行数:33,代码来源:goto_engine.py

示例12: _load_upgrades

# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get_broken_plugins [as 别名]
    def _load_upgrades(self, remove_applied=True):
        """
        Load upgrade modules

        Upgrade modules are loaded using pluginutils. The pluginutils module
        is either loaded from site-packages via normal or via a user-loaded
        module supplied in the __init__ method. This is useful when the engine
        is running before actually being installed into site-packages.

        @param remove_applied: if True, already applied upgrades will not
            be included, if False the entire upgrade graph will be
            returned.
        """
        if self.pluginutils is None:
            from invenio.pluginutils import PluginContainer
            from invenio.pluginutils import create_enhanced_plugin_builder
        else:
            PluginContainer = self.pluginutils.PluginContainer
            create_enhanced_plugin_builder = self.pluginutils.create_enhanced_plugin_builder

        if remove_applied:
            self.load_history()

        builder = create_enhanced_plugin_builder(
            compulsory_objects={
                'do_upgrade': dummy_signgature,
                'info': dummy_signgature,
            },
            optional_objects={
                'estimate': dummy_signgature,
                'pre_upgrade': dummy_signgature,
                'post_upgrade': dummy_signgature,
            },
            other_data={
                'depends_on': (list, []),
            },
        )

        # Load all upgrades
        plugins = PluginContainer(
            [os.path.join(p, '*.py') for p in self._paths],
            plugin_builder=builder,
            external=True,
        )

        # Check for broken plug-ins
        broken = plugins.get_broken_plugins()
        if broken:
            messages = []
            import traceback
            for plugin, info in broken.items():
                messages.append("Failed to load %s:\n"
                                " %s" % (plugin, "".join(traceback.format_exception(*info))))
            raise RuntimeError(*messages)

        # Store name and doc of plug-in in itself
        for plugin_id in plugins.keys():
            plugins[plugin_id]['id'] = plugin_id
            plugins[plugin_id]['repository'] = self._parse_plugin_id(plugin_id)

        return plugins
开发者ID:BessemAamira,项目名称:invenio,代码行数:63,代码来源:inveniocfg_upgrader.py


注:本文中的invenio.pluginutils.PluginContainer.get_broken_plugins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。