本文整理汇总了Python中invenio.pluginutils.PluginContainer.values方法的典型用法代码示例。如果您正苦于以下问题:Python PluginContainer.values方法的具体用法?Python PluginContainer.values怎么用?Python PluginContainer.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio.pluginutils.PluginContainer
的用法示例。
在下文中一共展示了PluginContainer.values方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_and_run_web_test_suite
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import values [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()
示例2: load_facet_builders
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import values [as 别名]
def load_facet_builders():
## Let's load all facets.
_FACETS = PluginContainer(
os.path.join(CFG_PYLIBDIR, 'invenio', 'websearch_facets', 'facet_*.py'),
plugin_builder=_invenio_facet_plugin_builder)
FACET_DICTS = dict((f.name, f) for f in _FACETS.values())
FACET_SORTED_LIST = sorted(FACET_DICTS.values(), key=lambda x: x.order)
current_app.config['FACET_DICTS'] = FACET_DICTS
current_app.config['FACET_SORTED_LIST'] = FACET_SORTED_LIST
示例3: build_and_run_regression_test_suite
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import values [as 别名]
def build_and_run_regression_test_suite():
"""
Detect all Invenio modules with names ending by
'*_regression_tests.py', build a complete test suite of them, and
run it. Called by 'inveniocfg --run-regression-tests'.
"""
test_modules_map = PluginContainer(
os.path.join(CFG_PYLIBDIR, 'invenio', '*_regression_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_regression_tests = ['%s (reason: %s)' % (name, broken_tests[name][1]) for name in broken_tests]
if broken_regression_tests:
warn("Broken regression tests suites found: %s" % ', '.join(broken_regression_tests))
warn_user_about_tests()
complete_suite = unittest.TestSuite(test_modules)
res = unittest.TextTestRunner(verbosity=2).run(complete_suite)
return res.wasSuccessful()