当前位置: 首页>>代码示例>>Python>>正文


Python testscenarios.load_tests_apply_scenarios函数代码示例

本文整理汇总了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)
开发者ID:ravisantoshgudimetla,项目名称:tempest,代码行数:25,代码来源:utils.py

示例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)
开发者ID:jd,项目名称:spotless,代码行数:28,代码来源:test_doctest.py

示例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)
开发者ID:igordcard,项目名称:neutron,代码行数:26,代码来源:test_checks.py

示例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)
开发者ID:electrocucaracha,项目名称:neutron,代码行数:27,代码来源:test_checks.py

示例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)
开发者ID:neumerance,项目名称:cloudcapped,代码行数:12,代码来源:test_doctest.py

示例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
开发者ID:gotostack,项目名称:neutron,代码行数:15,代码来源:testlib_api.py

示例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)
开发者ID:NetApp,项目名称:tempest,代码行数:15,代码来源:test.py

示例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
开发者ID:DinaBelova,项目名称:oslo.db,代码行数:16,代码来源:test_base.py

示例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)
开发者ID:AminaMseddi,项目名称:tempest,代码行数:17,代码来源:utils.py

示例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)
开发者ID:mshabdiz,项目名称:hacking,代码行数:18,代码来源:test_doctest.py

示例11: load_tests

def load_tests(loader, in_tests, pattern):
    return testscenarios.load_tests_apply_scenarios(loader, in_tests, pattern)
开发者ID:miphreal,项目名称:pbr,代码行数:2,代码来源:test_packaging.py


注:本文中的testscenarios.load_tests_apply_scenarios函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。