本文整理汇总了Python中nose.plugins.base.Plugin类的典型用法代码示例。如果您正苦于以下问题:Python Plugin类的具体用法?Python Plugin怎么用?Python Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: configure
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))
开发者ID:conorfi,项目名称:automation,代码行数:31,代码来源:testconfig.py
示例2: configure
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:],))
开发者ID:rupenp,项目名称:python-nlg,代码行数:25,代码来源:doctests.py
示例3: options
def options(self, parser, env=os.environ):
Plugin.options(self, parser, env)
parser.add_option("--cover-package", action="append",
default=env.get('NOSE_COVER_PACKAGE'),
dest="cover_packages",
help="Restrict coverage output to selected packages "
"[NOSE_COVER_PACKAGE]")
parser.add_option("--cover-erase", action="store_true",
default=env.get('NOSE_COVER_ERASE'),
dest="cover_erase",
help="Erase previously collected coverage "
"statistics before run")
parser.add_option("--cover-tests", action="store_true",
dest="cover_tests",
default=env.get('NOSE_COVER_TESTS'),
help="Include test modules in coverage report "
"[NOSE_COVER_TESTS]")
parser.add_option("--cover-inclusive", action="store_true",
dest="cover_inclusive",
default=env.get('NOSE_COVER_INCLUSIVE'),
help="Include all python files under working "
"directory in coverage report. Useful for "
"discovering holes in test coverage if not all "
"files are imported by the test suite. "
"[NOSE_COVER_INCLUSIVE]")
开发者ID:scbarber,项目名称:horriblepoems,代码行数:25,代码来源:cover.py
示例4: configure
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)
开发者ID:gregorynicholas,项目名称:nose-quickunit,代码行数:27,代码来源:plugin.py
示例5: options
def options(self, parser, env):
"""
Register command line options
"""
parser.add_option("--marvin-config", action="store",
default=env.get('MARVIN_CONFIG', './datacenter.cfg'),
dest="config",
help="Marvin's configuration file where the " +
"datacenter information is specified " +
"[MARVIN_CONFIG]")
parser.add_option("--result-log", action="store",
default=env.get('RESULT_LOG', None),
dest="result_log",
help="The path to the results file where test " +
"summary will be written to [RESULT_LOG]")
parser.add_option("--client-log", action="store",
default=env.get('DEBUG_LOG', 'debug.log'),
dest="debug_log",
help="The path to the testcase debug logs " +
"[DEBUG_LOG]")
parser.add_option("--load", action="store_true", default=False,
dest="load",
help="Only load the deployment configuration given")
Plugin.options(self, parser, env)
开发者ID:galaxyshen,项目名称:cloudstack,代码行数:25,代码来源:marvinPlugin.py
示例6: configure
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
开发者ID:AlexSnet,项目名称:oneline,代码行数:26,代码来源:doctests.py
示例7: configure
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()
开发者ID:pombredanne,项目名称:f5test2,代码行数:25,代码来源:testopia.py
示例8: configure
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
开发者ID:LucianU,项目名称:kuma-lib,代码行数:34,代码来源:cover.py
示例9: __init__
def __init__(self):
Plugin.__init__(self)
self.post_data_dir = None
self.max_postdata_threshold = None
self.__save_data_count = 0
self.__priv_sn = ''
self.du = DshUtils()
开发者ID:agrawalravi90,项目名称:pbspro,代码行数:7,代码来源:ptl_test_data.py
示例10: __init__
def __init__(self):
Plugin.__init__(self)
self.driver = None
self.config = {}
self.environment = None
self.driver_initializer_fn = lambda _: None
self.logger = holmium.core.log
开发者ID:johangozali,项目名称:holmium.core,代码行数:7,代码来源:noseplugin.py
示例11: options
def options(self, parser, env):
"""Sets additional command line options."""
Plugin.options(self, parser, env)
parser.add_option(
'--tddium-output-file', action='store',
dest='tddium_output_file', metavar="FILE",
default=env.get('TDDIUM_OUTPUT_FILE', 'tddium_output.json'))
开发者ID:KinaMarie,项目名称:nose_tddium,代码行数:7,代码来源:nose_tddium.py
示例12: configure
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')
开发者ID:dcramer,项目名称:kleenex,代码行数:30,代码来源:plugin.py
示例13: options
def options(self, parser, env):
"""
Sets additional command line options.
"""
Plugin.options(self, parser, env)
parser.add_option(
'--gc-per-context', action = 'store_true', dest = 'gc_per_context',
default = env.get('NOSE_GC_PER_CONTEXT', self._gcPerCtxt),
help = ("Perform garbage collection after each context. "
"Default is %s [NOSE_GC_PER_CONTEXT]" % self._gcPerCtxt)
)
parser.add_option(
'--gc-per-directory', action = 'store_true', dest = 'gc_per_directory',
default = env.get('NOSE_GC_PER_DIRECTORY', self._gcPerDir),
help = ("Perform garbage collection after each directory. "
"Default %is s [NOSE_GC_PER_DIRECTORY]" % self._gcPerDir)
)
parser.add_option(
'--gc-per-test', action = 'store_true', dest = 'gc_per_test',
default = env.get('NOSE_GC_PER_TEST', self._gcPerTest),
help = ("Perform garbage collection after each test. This can be VERY slow! "
"Default is %s [NOSE_GC_PER_TEST]" % self._gcPerTest)
)
parser.add_option(
'--gc-gen', action = 'store', dest = 'gc_gen',
default = env.get('NOSE_GC_GEN', self._gen),
help = "Garbage collection generation to run. Default is %d [NOSE_GC_GEN]" % self._gen
)
开发者ID:vrsource,项目名称:vrs_nose_plugins,代码行数:28,代码来源:aggressive_gc.py
示例14: options
def options(self, parser, env):
"""
Register command line options
"""
parser.add_option("--marvin-config", action="store",
default=env.get('MARVIN_CONFIG',
'./datacenter.cfg'),
dest="configFile",
help="Marvin's configuration file is required."
"The config file containing the datacenter and "
"other management server "
"information is specified")
parser.add_option("--deploy", action="store_true",
default=False,
dest="deployDc",
help="Deploys the DC with Given Configuration."
"Requires only when DC needs to be deployed")
parser.add_option("--zone", action="store",
default=None,
dest="zone",
help="Runs all tests against this specified zone")
parser.add_option("--hypervisor", action="store",
default=None,
dest="hypervisor_type",
help="Runs all tests against the specified "
"zone and hypervisor Type")
parser.add_option("--log-folder-path", action="store",
default=None,
dest="logFolder",
help="Collects all logs under the user specified"
"folder"
)
Plugin.options(self, parser, env)
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:33,代码来源:marvinPlugin.py
示例15: __init__
def __init__(self):
self.__identifier = None
self.__testClient = None
self.__logFolderPath = None
self.__parsedConfig = None
'''
Contains Config File
'''
self.__configFile = None
'''
Signifies the Zone against which all tests will be Run
'''
self.__zoneForTests = None
'''
Signifies the flag whether to deploy the New DC or Not
'''
self.__deployDcFlag = None
self.conf = None
self.__resultStream = stdout
self.__testRunner = None
self.__testResult = SUCCESS
self.__startTime = None
self.__testName = None
self.__tcRunLogger = None
self.__testModName = ''
self.__hypervisorType = None
'''
The Log Path provided by user where all logs are routed to
'''
self.__userLogPath = None
Plugin.__init__(self)
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:31,代码来源:marvinPlugin.py
示例16: options
def options(self, parser, env):
"""
Add options to command line.
"""
Plugin.options(self, parser, env)
parser.add_option("--cover3-package", action="append",
default=env.get('NOSE_COVER_PACKAGE'),
metavar="PACKAGE",
dest="cover_packages",
help="Restrict coverage output to selected packages "
"[NOSE_COVER_PACKAGE]")
parser.add_option("--cover3-erase", action="store_true",
default=env.get('NOSE_COVER_ERASE'),
dest="cover_erase",
help="Erase previously collected coverage "
"statistics before run")
parser.add_option("--cover3-tests", action="store_true",
dest="cover_tests",
default=env.get('NOSE_COVER_TESTS'),
help="Include test modules in coverage report "
"[NOSE_COVER_TESTS]")
parser.add_option("--cover3-branch", action="store_true",
dest="cover_branch",
default=env.get('NOSE_COVER_BRANCH'),
help="Include branch coverage. "
"[NOSE_COVER_BRANCH]")
parser.add_option("--cover3-exclude", action="store",
dest="cover_exclude",
default=env.get('NOSE_COVER_EXCLUDE'),
type="string",
help="List of modules to exclude from coverage. "
"Supports wildcard matching at both start and "
"end. Example: *.core.dispatch.* "
"[NOSE_COVER_EXCLUDE]")
parser.add_option("--cover3-inclusive", action="store_true",
dest="cover_inclusive",
default=env.get('NOSE_COVER_INCLUSIVE'),
help="Include all python files under working "
"directory in coverage report. Useful for "
"discovering holes in test coverage if not all "
"files are imported by the test suite. "
"[NOSE_COVER_INCLUSIVE]")
parser.add_option("--cover3-html", action="store_true",
default=env.get('NOSE_COVER_HTML'),
dest='cover_html',
help="Produce HTML coverage information")
parser.add_option('--cover3-html-dir', action='store',
default=env.get('NOSE_COVER_HTML_DIR', 'cover'),
dest='cover_html_dir',
metavar='DIR',
help='Produce HTML coverage information in dir')
parser.add_option('--cover3-xml', action='store_true',
default=env.get('NOSE_COVER_XML'),
dest='cover_xml',
help='Add Cobertura-style XML coverage reports')
parser.add_option('--cover3-xml-file', action='store',
default=env.get('NOSE_COVER_XML_FILE'),
dest='cover_xml_file',
help='File to write XML coverage report.')
开发者ID:armooo,项目名称:nosecover3,代码行数:60,代码来源:__init__.py
示例17: configure
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
开发者ID:iffy,项目名称:alfajor,代码行数:8,代码来源:nose.py
示例18: options
def options(self, parser, env=os.environ):
Plugin.options(self, parser, env)
# Test doctests in 'test' files / directories. Standard plugin default
# is False
self.doctest_tests = True
# Variable name; if defined, doctest results stored in this variable in
# the top-level namespace. None is the standard default
self.doctest_result_var = None
开发者ID:7924102,项目名称:numpy,代码行数:8,代码来源:noseclasses.py
示例19: __init__
def __init__(self):
Plugin.__init__(self)
self.param = None
self.lcov_bin = None
self.lcov_data = None
self.lcov_out = None
self.lcov_utils = None
self.genhtml_bin = None
开发者ID:gajendrasharmagit,项目名称:pbspro,代码行数:8,代码来源:ptl_test_runner.py
示例20: configure
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
开发者ID:thraxil,项目名称:gtreed,代码行数:8,代码来源:doctests.py
注:本文中的nose.plugins.base.Plugin类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论