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


Python builtin.plugins方法代码示例

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


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

示例1: makeCall

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def makeCall(self, call):
        if call == 'loadTestsFromNames':
            # special case -- load tests from names behaves somewhat differently
            # from other chainable calls, because plugins return a tuple, only
            # part of which can be chained to the next plugin.
            return self._loadTestsFromNames

        meth = self.method
        if getattr(meth, 'generative', False):
            # call all plugins and yield a flattened iterator of their results
            return lambda *arg, **kw: list(self.generate(*arg, **kw))
        elif getattr(meth, 'chainable', False):
            return self.chain
        else:
            # return a value from the first plugin that returns non-None
            return self.simple 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:18,代码来源:manager.py

示例2: generate

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def generate(self, *arg, **kw):
        """Call all plugins, yielding each item in each non-None result.
        """
        for p, meth in self.plugins:
            result = None
            try:
                result = meth(*arg, **kw)
                if result is not None:
                    for r in result:
                        yield r
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                exc = sys.exc_info()
                yield Failure(*exc)
                continue 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:18,代码来源:manager.py

示例3: __init__

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def __init__(self, call, plugins):
        try:
            self.method = getattr(self.interface, call)
        except AttributeError:
            raise AttributeError("%s is not a valid %s method"
                                 % (call, self.interface.__name__))
        self.call = self.makeCall(call)
        self.plugins = []
        for p in plugins:
            self.addPlugin(p, call) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:12,代码来源:manager.py

示例4: addPlugin

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def addPlugin(self, plugin, call):
        """Add plugin to my list of plugins to call, if it has the attribute
        I'm bound to.
        """
        meth = getattr(plugin, call, None)
        if meth is not None:
            if call == 'loadTestsFromModule' and \
                    len(inspect.getargspec(meth)[0]) == 2:
                orig_meth = meth
                meth = lambda module, path, **kwargs: orig_meth(module)
            self.plugins.append((plugin, meth)) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:13,代码来源:manager.py

示例5: chain

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def chain(self, *arg, **kw):
        """Call plugins in a chain, where the result of each plugin call is
        sent to the next plugin as input. The final output result is returned.
        """
        result = None
        # extract the static arguments (if any) from arg so they can
        # be passed to each plugin call in the chain
        static = [a for (static, a)
                  in zip(getattr(self.method, 'static_args', []), arg)
                  if static]
        for p, meth in self.plugins:
            result = meth(*arg, **kw)
            arg = static[:]
            arg.append(result)
        return result 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:17,代码来源:manager.py

示例6: _loadTestsFromNames

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def _loadTestsFromNames(self, names, module=None):
        """Chainable but not quite normal. Plugins return a tuple of
        (tests, names) after processing the names. The tests are added
        to a suite that is accumulated throughout the full call, while
        names are input for the next plugin in the chain.
        """
        suite = []
        for p, meth in self.plugins:
            result = meth(names, module=module)
            if result is not None:
                suite_part, names = result
                if suite_part:
                    suite.extend(suite_part)
        return suite, names 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:16,代码来源:manager.py

示例7: addPlugins

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def addPlugins(self, plugins):
        raise NotImplementedError() 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:4,代码来源:manager.py

示例8: __iter__

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def __iter__(self):
        return iter(self.plugins) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:4,代码来源:manager.py

示例9: configure

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def configure(self, options, config):
        """Configure the set of plugins with the given options
        and config instance. After configuration, disabled plugins
        are removed from the plugins list.
        """
        log.debug("Configuring plugins")
        self.config = config
        cfg = PluginProxy('configure', self._plugins)
        cfg(options, config)
        enabled = [plug for plug in self._plugins if plug.enabled]
        self.plugins = enabled
        self.sort()
        log.debug("Plugins enabled: %s", enabled) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:15,代码来源:manager.py

示例10: _set_plugins

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def _set_plugins(self, plugins):
        self._plugins = []
        self.addPlugins(plugins) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:5,代码来源:manager.py

示例11: loadPlugins

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def loadPlugins(self):
        """Load plugins by iterating the `nose.plugins` entry point.
        """
        from pkg_resources import iter_entry_points
        loaded = {}
        for entry_point, adapt in self.entry_points:
            for ep in iter_entry_points(entry_point):
                if ep.name in loaded:
                    continue
                loaded[ep.name] = True
                log.debug('%s load plugin %s', self.__class__.__name__, ep)
                try:
                    plugcls = ep.load()
                except KeyboardInterrupt:
                    raise
                except Exception, e:
                    # never want a plugin load to kill the test run
                    # but we can't log here because the logger is not yet
                    # configured
                    warn("Unable to load plugin %s: %s" % (ep, e),
                         RuntimeWarning)
                    continue
                if adapt:
                    plug = adapt(plugcls())
                else:
                    plug = plugcls()
                self.addPlugin(plug)
        super(EntryPointPluginManager, self).loadPlugins() 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:30,代码来源:manager.py

示例12: loadPlugins

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def loadPlugins(self):
            for plug in builtin.plugins:
                if plug != Doctest:
                    self.addPlugin(plug())
            self.addPlugin(DoctestFix())
            super(NltkPluginManager, self).loadPlugins() 
开发者ID:Thejas-1,项目名称:Price-Comparator,代码行数:8,代码来源:runtests.py

示例13: loadPlugins

# 需要导入模块: from nose.plugins import builtin [as 别名]
# 或者: from nose.plugins.builtin import plugins [as 别名]
def loadPlugins(self):
            for plug in builtin.plugins:
                if plug != Doctest:
                    self.addPlugin(plug())
            self.addPlugin(DoctestFix())
            if rednose_available:
                self.addPlugin(RedNose())

            super(NltkPluginManager, self).loadPlugins() 
开发者ID:sdoran35,项目名称:hate-to-hugs,代码行数:11,代码来源:runtests.py


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