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


Python manager.PluginManager方法代码示例

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


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

示例1: _execPlugin

# 需要导入模块: from nose.plugins import manager [as 别名]
# 或者: from nose.plugins.manager import PluginManager [as 别名]
def _execPlugin(self):
        """execute the plugin on the internal test suite.
        """
        from nose.config import Config
        from nose.core import TestProgram
        from nose.plugins.manager import PluginManager

        suite = None
        stream = Buffer()
        conf = Config(env=self.env,
                      stream=stream,
                      plugins=PluginManager(plugins=self.plugins))
        if self.ignoreFiles is not None:
            conf.ignoreFiles = self.ignoreFiles
        if not self.suitepath:
            suite = self.makeSuite()

        self.nose = TestProgram(argv=self.argv, config=conf, suite=suite,
                                exit=False)
        self.output = AccessDecorator(stream) 
开发者ID:singhj,项目名称:locality-sensitive-hashing,代码行数:22,代码来源:plugintest.py

示例2: test

# 需要导入模块: from nose.plugins import manager [as 别名]
# 或者: from nose.plugins.manager import PluginManager [as 别名]
def test(verbosity=1):
    """run the matplotlib test suite"""
    old_backend = rcParams['backend']
    try:
        use('agg')
        import nose
        import nose.plugins.builtin
        from .testing.noseclasses import KnownFailure
        from nose.plugins.manager import PluginManager
        from nose.plugins import multiprocess

        # store the old values before overriding
        plugins = []
        plugins.append( KnownFailure() )
        plugins.extend( [plugin() for plugin in nose.plugins.builtin.plugins] )

        manager = PluginManager(plugins=plugins)
        config = nose.config.Config(verbosity=verbosity, plugins=manager)

        # Nose doesn't automatically instantiate all of the plugins in the
        # child processes, so we have to provide the multiprocess plugin with
        # a list.
        multiprocess._instantiate_plugins = [KnownFailure]

        success = nose.run( defaultTest=default_test_modules,
                            config=config,
                            )
    finally:
        if old_backend.lower() != 'agg':
            use(old_backend)

    return success 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:34,代码来源:__init__.py

示例3: test

# 需要导入模块: from nose.plugins import manager [as 别名]
# 或者: from nose.plugins.manager import PluginManager [as 别名]
def test(verbosity=1):
    """run the matplotlib test suite"""
    old_backend = rcParams['backend']
    try:
        use('agg')
        import nose
        import nose.plugins.builtin
        from .testing.noseclasses import KnownFailure
        from nose.plugins.manager import PluginManager
        from nose.plugins import multiprocess

        # store the old values before overriding
        plugins = []
        plugins.append( KnownFailure() )
        plugins.extend( [plugin() for plugin in nose.plugins.builtin.plugins] )

        manager = PluginManager(plugins=plugins)
        config = nose.config.Config(verbosity=verbosity, plugins=manager)

        # Nose doesn't automatically instantiate all of the plugins in the
        # child processes, so we have to provide the multiprocess plugin with
        # a list.
        multiprocess._instantiate_plugins = [KnownFailure]

        success = nose.run(
            defaultTest=default_test_modules,
            config=config,
        )
    finally:
        if old_backend.lower() != 'agg':
            use(old_backend)

    return success 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:35,代码来源:__init__.py

示例4: run

# 需要导入模块: from nose.plugins import manager [as 别名]
# 或者: from nose.plugins.manager import PluginManager [as 别名]
def run(*arg, **kw):
    """
    Specialized version of nose.run for use inside of doctests that
    test test runs.

    This version of run() prints the result output to stdout.  Before
    printing, the output is processed by replacing the timing
    information with an ellipsis (...), removing traceback stacks, and
    removing trailing whitespace.

    Use this version of run wherever you are writing a doctest that
    tests nose (or unittest) test result output.

    Note: do not use doctest: +ELLIPSIS when testing nose output,
    since ellipses ("test_foo ... ok") in your expected test runner
    output may match multiple lines of output, causing spurious test
    passes!
    """
    from nose import run
    from nose.config import Config
    from nose.plugins.manager import PluginManager

    buffer = Buffer()
    if 'config' not in kw:
        plugins = kw.pop('plugins', [])
        if isinstance(plugins, list):
            plugins = PluginManager(plugins=plugins)
        env = kw.pop('env', {})
        kw['config'] = Config(env=env, plugins=plugins)
    if 'argv' not in kw:
        kw['argv'] = ['nosetests', '-v']
    kw['config'].stream = buffer

    # Set up buffering so that all output goes to our buffer,
    # or warn user if deprecated behavior is active. If this is not
    # done, prints and warnings will either be out of place or
    # disappear.
    stderr = sys.stderr
    stdout = sys.stdout
    if kw.pop('buffer_all', False):
        sys.stdout = sys.stderr = buffer
        restore = True
    else:
        restore = False
        warn("The behavior of nose.plugins.plugintest.run() will change in "
             "the next release of nose. The current behavior does not "
             "correctly account for output to stdout and stderr. To enable "
             "correct behavior, use run_buffered() instead, or pass "
             "the keyword argument buffer_all=True to run().",
             DeprecationWarning, stacklevel=2)
    try:
        run(*arg, **kw)
    finally:
        if restore:
            sys.stderr = stderr
            sys.stdout = stdout
    out = buffer.getvalue()
    print munge_nose_output_for_doctest(out) 
开发者ID:singhj,项目名称:locality-sensitive-hashing,代码行数:60,代码来源:plugintest.py


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