本文整理汇总了Python中nose.plugins.Plugin类的典型用法代码示例。如果您正苦于以下问题:Python Plugin类的具体用法?Python Plugin怎么用?Python Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
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 mothods is %s\n" % self.pattern)
示例2: options
def options(self, parser, env):
Plugin.options(self, parser, env)
parser.add_option('--id-file', action='store', dest='testIdFile',
default='.noseids',
help="Store test ids found in test runs in this "
"file. Default is the file .noseids in the "
"working directory.")
示例3: options
def options(self, parser, env=os.environ):
Plugin.options(self, parser, env)
parser.add_option(
"-u", "--select-unittests", action="store_true",
default=False, dest="select_unittests",
help="Run all unittests"
)
parser.add_option(
"--select-databasetests", action="store_true",
default=False, dest="select_databasetests",
help="Run all database tests"
)
parser.add_option(
"--select-destructivedatabasetests", action="store_true",
default=False, dest="select_destructivedatabasetests",
help="Run all destructive database tests"
)
parser.add_option(
"--select-httptests", action="store_true",
default=False, dest="select_httptests",
help="Run all HTTP tests"
)
parser.add_option(
"--select-seleniumtests", action="store_true",
default=False, dest="select_seleniumtests",
help="Run all Selenium tests"
)
示例4: configure
def configure(self, options, config):
# Configure
Plugin.configure(self, options, config)
# Set options
if options.enable_plugin_specplugin:
options.verbosity = max(options.verbosity, 2)
self.spec_doctests = options.spec_doctests
# Color setup
for label, color in list({
'error': 'red',
'ok': 'green',
'deprecated': 'yellow',
'skipped': 'yellow',
'failure': 'red',
'identifier': 'cyan',
'file': 'blue',
}.items()):
# No color: just print() really
func = lambda text, bold=False: text
if not options.no_spec_color:
# Color: colorizes!
func = partial(colorize, color)
# Store in dict (slightly quicker/nicer than getattr)
self.color[label] = func
# Add attribute for easier hardcoded access
setattr(self, label, func)
示例5: configure
def configure(self, options, conf):
"""Configure the plugin"""
Plugin.configure(self, options, conf)
for setting_str in options.env:
env_variable, value = setting_str.split('=')
os.environ[env_variable] = value
示例6: options
def options(self, parser, env):
Plugin.options(self, parser, env)
parser.add_option(
'--artifact-dir', action='store',
dest='artifact_dir', metavar="DIR",
help=("Root artifact directory for testrun. [Default " \
"is new sub-dir under /tmp]"))
示例7: options
def options(self, parser, env):
Plugin.options(self, parser, env)
parser.add_option('--mutations-path', action='store',
default='.',
dest='mutations_path',
help='Restrict mutations to source files in this path'
' (default: current working directory)')
parser.add_option('--mutations-exclude', action='store',
metavar='REGEX', default=None,
dest='mutations_exclude',
help='Exclude mutations for source files containing '
'this pattern (default: None)')
parser.add_option('--mutations-exclude-lines', action='store',
metavar='REGEX',
default=self.exclude_lines_pattern,
dest='mutations_exclude_lines',
help='Exclude mutations for lines containing this '
'pattern (default: \'%s\'' %
self.exclude_lines_pattern)
parser.add_option('--mutations-mutators-modules', action='store',
default='elcap.mutator',
dest='mutators_modules',
help='Comma separated list of modules where the '
'Mutators are defined.')
parser.add_option('--mutations-mutators', action='store',
default='',
dest='mutators',
help='Comma separated list of mutators to use. '
'Example: BooleanMutator,NumberMutator. An '
'empty list implies all Mutators in the defined '
'modules will be used.')
示例8: options
def options(self, parser, env):
Plugin.options(self, parser, env)
parser.add_option("--re-pattern",
dest="pattern", action="store",
default=env.get("NOSE_REGEX_PATTERN", "test.*"),
help=("Run test methods that have a method name \
matching this regular expression"))
示例9: configure
def configure(self, options, config):
'''Configure the plug in'''
# Call super
Plugin.configure(self, options, config)
# ---------------------------------------------------------------------
# NOSE
# ---------------------------------------------------------------------
# Store the configuration
self.config = config
# Check if processes enabled
try: self.fork = 1 != max(int(options.multiprocess_workers), 1)
# If multiprocess not available
except: self.fork = False
# ---------------------------------------------------------------------
# CORE
# ---------------------------------------------------------------------
# Store test target folder
self.core_target = os.path.abspath(options.core_target)
# Store source folder
if options.source: self.source = os.path.abspath(options.source)
else: self.source = None
# Check if has to search sources
self.search_source = options.search_source
# Check if has to search tests
self.search_test = options.search_test
示例10: __init__
def __init__(self):
Plugin.__init__(self)
import uuid
self.ds_name = "queueblame-%s" % str(uuid.uuid4())[0:6]
from collections import defaultdict
self.queues_by_test = defaultdict(lambda: defaultdict(dict))
示例11: options
def options(self, parser, env=os.environ):
'''Add launch options for NoseXUnitLite'''
# Call super
Plugin.options(self, parser, env)
# ---------------------------------------------------------------------
# CORE
# ---------------------------------------------------------------------
# Add test target folder
parser.add_option('--core-target',
action='store',
default = nconst.TARGET_CORE,
dest='core_target',
help='Output folder for test reports (default is %s).' % nconst.TARGET_CORE)
# Add source folder
parser.add_option('--source-folder',
action='store',
default=None,
dest='source',
help='Set source folder (optional). Add folder in sys.path.')
# Search sources in source tree
parser.add_option('--search-source',
action='store_true',
default=False,
dest='search_source',
help="Walk in the source folder to add deeper folders in sys.path if they don't contain __init__.py file. Works only if --source-folder is defined.")
# Search tests in
parser.add_option('--search-test',
action='store_true',
default=False,
dest='search_test',
help='Search tests in folders with no __init__.py file (default: do nothing).')
示例12: __init__
def __init__(self):
Plugin.__init__(self)
self.ccs = []
self.container_started = False
self.blames = {"scidata": [], "state": [], "directory": [], "events": [], "resources": [], "objects": []}
self.last_blame = {}
self.sysname = None
示例13: __init__
def __init__(self):
Plugin.__init__(self)
self.stream_capturer = StreamCapturer()
self.destination = os.environ.get('IPTEST_SUBPROC_STREAMS', 'capture')
# This is ugly, but distant parts of the test machinery need to be able
# to redirect streams, so we make the object globally accessible.
nose.iptest_stdstreams_fileno = self.get_write_fileno
示例14: options
def options(self, parser, env=os.environ):
# print "Options for nose plugin:", self.name # dbg
Plugin.options(self, parser, env)
parser.add_option(
"--ipdoctest-tests",
action="store_true",
dest="ipdoctest_tests",
default=env.get("NOSE_IPDOCTEST_TESTS", True),
help="Also look for doctests in test modules. "
"Note that classes, methods and functions should "
"have either doctests or non-doctest tests, "
"not both. [NOSE_IPDOCTEST_TESTS]",
)
parser.add_option(
"--ipdoctest-extension",
action="append",
dest="ipdoctest_extension",
help="Also look for doctests in files with " "this extension [NOSE_IPDOCTEST_EXTENSION]",
)
# Set the default as a list, if given in env; otherwise
# an additional value set on the command line will cause
# an error.
env_setting = env.get("NOSE_IPDOCTEST_EXTENSION")
if env_setting is not None:
parser.set_defaults(ipdoctest_extension=tolist(env_setting))
示例15: configure
def configure(self, options, conf):
log.debug("Configuring PSCTest2NosePlugin")
Plugin.configure(self, options, conf)
self.conf = conf
if hasattr(self.conf.options, 'collect_only'):
self.collect_only = getattr(self.conf.options, 'collect_only')
log.debug("self.collect_only is %s" % self.collect_only)
self.buildConfig = getattr(self.conf.options, 'build_config') if hasattr(self.conf.options, 'build_config') else None