Esempio n. 1
0
def pytest_configure(config):

    if config.getoption('--help'):
        return
    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [DummyAppliance.from_config(config)]
        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances, config.option.appliance_version)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    elif config.getoption('--use-sprout'):
        from cfme.test_framework.sprout.plugin import mangle_in_sprout_appliances

        mangle_in_sprout_appliances(config)
        # TODO : handle direct sprout pass on?
        appliances = appliances_from_cli(config.option.appliances, None)
        reporter.write_line('Retrieved these appliances from the --sprout-* parameters', red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line('* {!r}'.format(appliance), cyan=True)
    appliance = appliances[0]
    if not appliance.is_dev:
        appliance.set_session_timeout(86400)
    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, PLUGIN_KEY)
Esempio n. 2
0
def pytest_configure(config):

    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [DummyAppliance.from_config(config)]
        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    elif config.getoption('--use-sprout'):
        from .sprout.plugin import mangle_in_sprout_appliances
        mangle_in_sprout_appliances(config)
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --sprout-* parameters', red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line('* {!r}'.format(appliance), cyan=True)
    appliance = appliances[0]
    appliance.set_session_timeout(86400)
    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, "appliance-holder")
Esempio n. 3
0
def pytest_configure(config):

    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [DummyAppliance.from_config(config)]
        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances, config.option.appliance_version)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    elif config.getoption('--use-sprout'):
        from .sprout.plugin import mangle_in_sprout_appliances

        mangle_in_sprout_appliances(config)
        # TODO : handle direct sprout pass on?
        appliances = appliances_from_cli(config.option.appliances, None)
        reporter.write_line('Retrieved these appliances from the --sprout-* parameters', red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line('* {!r}'.format(appliance), cyan=True)
    appliance = appliances[0]
    if not appliance.is_dev:
        appliance.set_session_timeout(86400)
    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, PLUGIN_KEY)
Esempio n. 4
0
def pytest_configure(config):

    if config.getoption('--help'):
        return
    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [
            DummyAppliance.from_config(config)
            for _ in range(config.getoption('--num-dummies'))
        ]
        if not config.option.collectonly:
            config.option.collectonly = True

        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances,
                                         config.option.appliance_version)
        reporter.write_line(
            'Retrieved these appliances from the --appliance parameters',
            red=True)
    elif config.getoption('--use-sprout'):
        from cfme.test_framework.sprout.plugin import mangle_in_sprout_appliances

        mangle_in_sprout_appliances(config)
        # TODO : handle direct sprout pass on?
        appliances = appliances_from_cli(config.option.appliances, None)
        reporter.write_line(
            'Retrieved these appliances from the --sprout-* parameters',
            red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env',
                            red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line(f'* {appliance!r}', cyan=True)
    appliance = appliances[0]

    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, PLUGIN_KEY)

    if not any((isinstance(appliance, DummyAppliance), appliance.is_dev)):
        config.hook.pytest_appliance_setup(config=config)