本文整理汇总了Python中nose.plugins.builtin方法的典型用法代码示例。如果您正苦于以下问题:Python plugins.builtin方法的具体用法?Python plugins.builtin怎么用?Python plugins.builtin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nose.plugins
的用法示例。
在下文中一共展示了plugins.builtin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_custom_doctester
# 需要导入模块: from nose import plugins [as 别名]
# 或者: from nose.plugins import builtin [as 别名]
def _get_custom_doctester(self):
""" Return instantiated plugin for doctests
Allows subclassing of this class to override doctester
A return value of None means use the nose builtin doctest plugin
"""
from .noseclasses import NumpyDoctest
return NumpyDoctest()
示例2: prepare_test_args
# 需要导入模块: from nose import plugins [as 别名]
# 或者: from nose.plugins import builtin [as 别名]
def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
doctests=False, coverage=False):
"""
Run tests for module using nose.
This method does the heavy lifting for the `test` method. It takes all
the same arguments, for details see `test`.
See Also
--------
test
"""
# fail with nice error message if nose is not present
import_nose()
# compile argv
argv = self._test_argv(label, verbose, extra_argv)
# our way of doing coverage
if coverage:
argv += ['--cover-package=%s' % self.package_name, '--with-coverage',
'--cover-tests', '--cover-erase']
# construct list of plugins
import nose.plugins.builtin
from .noseclasses import KnownFailurePlugin, Unplugger
plugins = [KnownFailurePlugin()]
plugins += [p() for p in nose.plugins.builtin.plugins]
# add doctesting if required
doctest_argv = '--with-doctest' in argv
if doctests == False and doctest_argv:
doctests = True
plug = self._get_custom_doctester()
if plug is None:
# use standard doctesting
if doctests and not doctest_argv:
argv += ['--with-doctest']
else: # custom doctesting
if doctest_argv: # in fact the unplugger would take care of this
argv.remove('--with-doctest')
plugins += [Unplugger('doctest'), plug]
if doctests:
argv += ['--with-' + plug.name]
return argv, plugins
示例3: prepare_test_args
# 需要导入模块: from nose import plugins [as 别名]
# 或者: from nose.plugins import builtin [as 别名]
def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
doctests=False, coverage=False):
"""
Run tests for module using nose.
This method does the heavy lifting for the `test` method. It takes all
the same arguments, for details see `test`.
See Also
--------
test
"""
# fail with nice error message if nose is not present
import_nose()
# compile argv
argv = self._test_argv(label, verbose, extra_argv)
# bypass tests noted for exclude
for ename in self.excludes:
argv += ['--exclude', ename]
# our way of doing coverage
if coverage:
argv+=['--cover-package=%s' % self.package_name, '--with-coverage',
'--cover-tests', '--cover-erase']
# construct list of plugins
import nose.plugins.builtin
from .noseclasses import KnownFailure, Unplugger
plugins = [KnownFailure()]
plugins += [p() for p in nose.plugins.builtin.plugins]
# add doctesting if required
doctest_argv = '--with-doctest' in argv
if doctests == False and doctest_argv:
doctests = True
plug = self._get_custom_doctester()
if plug is None:
# use standard doctesting
if doctests and not doctest_argv:
argv += ['--with-doctest']
else: # custom doctesting
if doctest_argv: # in fact the unplugger would take care of this
argv.remove('--with-doctest')
plugins += [Unplugger('doctest'), plug]
if doctests:
argv += ['--with-' + plug.name]
return argv, plugins