本文整理汇总了Python中testscenarios.load_tests_apply_scenarios函数的典型用法代码示例。如果您正苦于以下问题:Python load_tests_apply_scenarios函数的具体用法?Python load_tests_apply_scenarios怎么用?Python load_tests_apply_scenarios使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_tests_apply_scenarios函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_tests_input_scenario_utils
def load_tests_input_scenario_utils(*args):
"""
Wrapper for testscenarios to set the scenarios to avoid running a getattr
on the CONF object at import.
"""
if getattr(args[0], "suiteClass", None) is not None:
loader, standard_tests, pattern = args
else:
standard_tests, module, loader = args
output = None
scenario_utils = None
try:
scenario_utils = InputScenarioUtils()
scenario_flavor = scenario_utils.scenario_flavors
scenario_image = scenario_utils.scenario_images
except (exc_lib.InvalidCredentials, TypeError):
output = standard_tests
finally:
if scenario_utils:
scenario_utils.clear_creds()
if output is not None:
return output
for test in testtools.iterate_tests(standard_tests):
setattr(test, "scenarios", testscenarios.multiply_scenarios(scenario_image, scenario_flavor))
return testscenarios.load_tests_apply_scenarios(*args)
示例2: load_tests
def load_tests(loader, tests, pattern):
flake8_style = engine.get_style_guide(parse_argv=False,
# Ignore H104 otherwise it's
# raised on doctests.
ignore=('F', 'H104'))
options = flake8_style.options
for entry in pkg_resources.iter_entry_points('flake8.extension'):
if not entry.module_name.startswith('spotless.'):
continue
check = entry.load()
name = entry.attrs[0]
if check.skip_on_py3 and six.PY3:
continue
for (lineno, (raw, (code, source))) in enumerate(
test_doctest._get_lines(check)):
lines = [part.replace(r'\t', '\t') + '\n'
for part in source.split(r'\n')]
test_doctest.file_cases.append(("%s-%s-line-%s"
% (entry.name, name, lineno),
dict(
lines=lines,
raw=raw,
options=options,
code=code)))
return testscenarios.load_tests_apply_scenarios(loader, tests, pattern)
示例3: load_tests
def load_tests(loader, tests, pattern):
default_checks = [e.name for e
in pkg_resources.iter_entry_points('flake8.extension')]
flake8_style = engine.get_style_guide(
parse_argv=False,
# We are testing neutron-specific hacking rules, so there is no need
# to run the checks registered by hacking or other flake8 extensions.
ignore=default_checks)
options = flake8_style.options
for name, check in checks.__dict__.items():
if not hasattr(check, 'name'):
continue
if check.name != checks.__name__:
continue
if not check.__doc__:
continue
for (lineno, (raw, line)) in enumerate(_get_lines(check)):
code, __, filename, source = line
lines = [part.replace(r'\t', '\t') + '\n'
for part in source.split(r'\n')]
file_cases.append(("%s-line-%s" % (name, lineno),
dict(lines=lines, raw=raw, options=options,
code=code, filename=filename)))
return testscenarios.load_tests_apply_scenarios(loader, tests, pattern)
示例4: load_tests
def load_tests(loader, tests, pattern):
flake8_style = engine.get_style_guide(
parse_argv=False,
# Ignore H104 otherwise it's
# raised on doctests.
ignore=("F", "H104"),
)
options = flake8_style.options
for name, check in checks.__dict__.items():
if not hasattr(check, "name"):
continue
if check.name != checks.__name__:
continue
if not check.__doc__:
continue
for (lineno, (raw, line)) in enumerate(_get_lines(check)):
code, __, filename, source = line
lines = [part.replace(r"\t", "\t") + "\n" for part in source.split(r"\n")]
file_cases.append(
(
"%s-line-%s" % (name, lineno),
dict(lines=lines, raw=raw, options=options, code=code, filename=filename),
)
)
return testscenarios.load_tests_apply_scenarios(loader, tests, pattern)
示例5: load_tests
def load_tests(loader, tests, pattern):
flake8_style = engine.get_style_guide(parse_argv=False, ignore="F")
options = flake8_style.options
for name, check in hacking.core.__dict__.items():
if not name.startswith("hacking_"):
continue
for (lineno, (raw, (code, source))) in enumerate(_get_lines(check)):
lines = [part.replace(r"\t", "\t") + "\n" for part in source.split(r"\n")]
file_cases.append(("%s-line-%s" % (name, lineno), dict(lines=lines, raw=raw, options=options, code=code)))
return testscenarios.load_tests_apply_scenarios(loader, tests, pattern)
示例6: module_load_tests
def module_load_tests(loader, found_tests, pattern):
"""Apply OptimisingTestSuite on a per-module basis.
FIXME(zzzeek): oslo.db provides this but the contract that
"pattern" should be None no longer seems to behave as it used
to at the module level, so this function needs to be added in this
form.
"""
result = testresources.OptimisingTestSuite()
found_tests = testscenarios.load_tests_apply_scenarios(
loader, found_tests, pattern)
result.addTest(found_tests)
return result
示例7: load_tests
def load_tests(*args):
"""
Wrapper for testscenarios to set the mandatory scenarios variable
only in case a real test loader is in place. Will be automatically
called in case the variable "load_tests" is set.
"""
if getattr(args[0], "suiteClass", None) is not None:
loader, standard_tests, pattern = args
else:
standard_tests, module, loader = args
for test in testtools.iterate_tests(standard_tests):
schema_file = getattr(test, "_schema_file", None)
if schema_file is not None:
setattr(test, "scenarios", NegativeAutoTest.generate_scenario(schema_file))
return testscenarios.load_tests_apply_scenarios(*args)
示例8: load_tests
def load_tests(loader, found_tests, pattern):
# pattern is None if the directive is placed within
# a test module directly, as well as within certain test
# discovery patterns
if pattern is not None:
pkg_tests = loader.discover(start_dir=this_dir, pattern=pattern)
result = testresources.OptimisingTestSuite()
found_tests = testscenarios.load_tests_apply_scenarios(
loader, found_tests, pattern)
result.addTest(found_tests)
if pattern is not None:
result.addTest(pkg_tests)
return result
示例9: load_tests_input_scenario_utils
def load_tests_input_scenario_utils(*args):
"""
Wrapper for testscenarios to set the scenarios to avoid running a getattr
on the CONF object at import.
"""
if getattr(args[0], 'suiteClass', None) is not None:
loader, standard_tests, pattern = args
else:
standard_tests, module, loader = args
scenario_utils = InputScenarioUtils()
scenario_flavor = scenario_utils.scenario_flavors
scenario_image = scenario_utils.scenario_images
for test in testtools.iterate_tests(standard_tests):
setattr(test, 'scenarios', testscenarios.multiply_scenarios(
scenario_image,
scenario_flavor))
return testscenarios.load_tests_apply_scenarios(*args)
示例10: load_tests
def load_tests(loader, tests, pattern):
flake8_style = engine.get_style_guide(parse_argv=False,
# Ignore H104 otherwise it's
# raised on doctests.
ignore=('F', 'H104'))
options = flake8_style.options
for name, check in hacking.core.__dict__.items():
if not name.startswith("hacking_"):
continue
for (lineno, (raw, (code, source))) in enumerate(_get_lines(check)):
lines = [part.replace(r'\t', '\t') + '\n'
for part in source.split(r'\n')]
file_cases.append(("%s-line-%s" % (name, lineno),
dict(lines=lines, raw=raw, options=options,
code=code)))
return testscenarios.load_tests_apply_scenarios(loader, tests, pattern)
示例11: load_tests
def load_tests(loader, in_tests, pattern):
return testscenarios.load_tests_apply_scenarios(loader, in_tests, pattern)