本文整理汇总了Python中nose.plugins.base.Plugin.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.configure方法的具体用法?Python Plugin.configure怎么用?Python Plugin.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nose.plugins.base.Plugin
的用法示例。
在下文中一共展示了Plugin.configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configure plugin.
"""
Plugin.configure(self, options, config)
self.doctest_result_var = options.doctest_result_var
self.doctest_tests = options.doctest_tests
self.extension = tolist(options.doctestExtension)
self.fixtures = options.doctestFixtures
self.finder = doctest.DocTestFinder()
self.optionflags = 0
if options.doctestOptions:
flags = ",".join(options.doctestOptions).split(',')
for flag in flags:
try:
if flag.startswith('+'):
self.optionflags |= getattr(doctest, flag[1:])
elif flag.startswith('-'):
self.optionflags &= ~getattr(doctest, flag[1:])
else:
raise ValueError(
"Must specify doctest options with starting " +
"'+' or '-'. Got %s" % (flag,))
except AttributeError:
raise ValueError("Unknown doctest option %s" %
(flag[1:],))
示例2: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
Plugin.configure(self, options, config)
if not self.enabled:
return
self.verbosity = options.verbosity
if options.quickunit_prefix:
self.prefixes = options.quickunit_prefix
if len(self.prefixes) == 1:
self.prefixes = self.prefixes[0].split('\n')
else:
self.prefixes = ["tests/"]
self.parent = 'master'
self.logger = logging.getLogger(__name__)
# pending files becomes a set of directorie pieces that represent
# the file locations changed in this diff
# for example, if /foo/bar/baz.py was changed, pending files would contain
# set([('foo', 'bar', 'baz')])
self.pending_files = set()
# diff is a mapping of filename->set(linenos)
self.diff_data = defaultdict(set)
# store a list of filenames that should be accepted
self.file_cache = FileAcceptedCache(self.prefixes, self.pending_files, self.diff_data)
示例3: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""
Configure plugin.
"""
try:
self.status.pop('active')
except KeyError:
pass
Plugin.configure(self, options, config)
if self.enabled:
try:
import coverage
except ImportError:
log.error("Coverage not available: "
"unable to import coverage module")
self.enabled = False
return
self.conf = config
self.coverErase = options.cover_erase
self.coverTests = options.cover_tests
self.coverPackages = []
if options.cover_packages:
for pkgs in [tolist(x) for x in options.cover_packages]:
self.coverPackages.extend(pkgs)
self.coverInclusive = options.cover_inclusive
if self.coverPackages:
log.info("Coverage report will include only packages: %s",
self.coverPackages)
self.coverHtmlDir = None
if options.cover_html:
self.coverHtmlDir = options.cover_html_dir
log.debug('Will put HTML coverage report in %s', self.coverHtmlDir)
if self.enabled:
self.status['active'] = True
示例4: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, noseconfig):
""" Call the super and then validate and call the relevant parser for
the configuration file passed in """
if not options.testconfig:
return
Plugin.configure(self, options, noseconfig)
self.config = noseconfig
if not options.capture:
self.enabled = False
if options.testconfigformat:
self.format = options.testconfigformat
if self.format not in self.valid_loaders.keys():
raise Exception('%s is not a valid configuration file format' \
% self.format)
# Load the configuration file:
self.valid_loaders[self.format](options.testconfig)
if options.overrides:
self.overrides = []
overrides = tolist(options.overrides)
for override in overrides:
keys, val = override.split(":")
if options.exact:
config[keys] = val
else:
ns = ''.join(['["%s"]' % i for i in keys.split(".") ])
# BUG: Breaks if the config value you're overriding is not
# defined in the configuration file already. TBD
exec('config%s = "%s"' % (ns, val))
示例5: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
Plugin.configure(self, options, config)
if not self.enabled:
return
config = read_config(options.kleenex_config, options.kleenex_config_section)
self.config = config
assert not (self.config.discover and self.config.record), "You cannot use both `record` and `discover` options."
self.logger = logging.getLogger(__name__)
self.pending_funcs = set()
# diff is a mapping of filename->set(linenos)
self.diff_data = defaultdict(set)
# cov is a mapping of filename->set(linenos)
self.cov_data = defaultdict(set)
# test test_name->dict(filename->set(linenos))
self.test_data = defaultdict(dict)
report_output = config.report_output
if not report_output or report_output == '-':
self.report_file = None
elif report_output.startswith('sys://'):
pipe = report_output[6:]
assert pipe in ('stdout', 'stderr')
self.report_file = getattr(sys, pipe)
else:
self.report_file = open(report_output, 'w')
示例6: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, noseconfig):
""" Call the super and then validate and call the relevant parser for
the configuration file passed in """
from ..interfaces.xmlrpc import BugzillaInterface
from ..interfaces.config import ConfigInterface
import f5test.commands.icontrol as ICMD
import f5test.commands.testopia as TCMD
Plugin.configure(self, options, noseconfig)
self.options = options
if options.with_testopia or options.syncplan:
self.enabled = True
else:
return
self.config_ifc = ConfigInterface()
testopia = self.config_ifc.api.testopia
self.testopia_ifc = BugzillaInterface(testopia.address,
testopia.username, testopia.password)
self.ICMD = ICMD
self.TCMD = TCMD
self.product = 'Enterprise Manager'
self.tcs = {}
self.tcs_ran = set()
示例7: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configure plugin.
"""
Plugin.configure(self, options, config)
self.doctest_result_var = options.doctest_result_var
self.doctest_tests = options.doctest_tests
self.extension = tolist(options.doctestExtension)
self.fixtures = options.doctestFixtures
self.finder = doctest.DocTestFinder()
self.optionflags = 0
if options.doctestOptions:
flags = ",".join(options.doctestOptions).split(',')
for flag in flags:
if not flag or flag[0] not in '+-':
raise ValueError(
"Must specify doctest options with starting " +
"'+' or '-'. Got %s" % (flag,))
mode, option_name = flag[0], flag[1:]
option_flag = doctest.OPTIONFLAGS_BY_NAME.get(option_name)
if not option_flag:
raise ValueError("Unknown doctest option %s" %
(option_name,))
if mode == '+':
self.optionflags |= option_flag
elif mode == '-':
self.optionflags &= ~option_flag
示例8: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configures the xunit plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
self.stats = {"errors": 0, "failures": 0, "passes": 0, "skipped": 0}
self.errorlist = []
self.error_report_file = codecs.open(options.xunit_file, "w", self.encoding, "replace")
示例9: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, conf):
Plugin.configure(self, options, conf)
self.pattern = options.pattern
if options.verbosity >= 2:
self.verbose = True
if self.enabled:
err.write("Pattern for matching test methods is %s\n" % self.pattern)
示例10: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configures the plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
self.output_file = options.tddium_output_file
self.byfile = {}
self.basepath = os.path.abspath('.') + '/'
示例11: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
Plugin.configure(self, options, config)
alfajor_options = {}
for key, value in vars(options).iteritems():
if key.startswith('alfajor_'):
short = key[len('alfajor_'):]
alfajor_options[short] = value
self.options = alfajor_options
示例12: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
Plugin.configure(self, options, config)
self.doctest_tests = options.doctest_tests
try:
self.extension = tolist(options.doctestExtension)
except AttributeError:
# 2.3, no other-file option
self.extension = None
示例13: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configure plugin.
"""
Plugin.configure(self, options, config)
self.doctest_result_var = options.doctest_result_var
self.doctest_tests = options.doctest_tests
self.extension = tolist(options.doctestExtension)
self.fixtures = options.doctestFixtures
self.finder = doctest.DocTestFinder()
示例14: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configure which kinds of failures trigger plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
if options.debugFailures and options.debugErrors:
raise ValueError("--errors-only and --failures-only are mutually exclusive")
self.enabled_for_errors = not options.debugFailures
self.enabled_for_failures = not options.debugErrors
示例15: configure
# 需要导入模块: from nose.plugins.base import Plugin [as 别名]
# 或者: from nose.plugins.base.Plugin import configure [as 别名]
def configure(self, options, config):
"""Configures the xunit plugin."""
Plugin.configure(self, options, config)
self.config = config
if self.enabled:
self.stats = {"errors": 0, "failures": 0, "passes": 0, "skipped": 0}
self.errorlist = []
if UNICODE_STRINGS:
self.error_report_file = open(options.xunit_file, "w", encoding=self.encoding)
else:
self.error_report_file = open(options.xunit_file, "w")