Beispiel #1
0
def pytest_collection_modifyitems(config, items):
    print("")

    set_transport(config.getoption("--transport"))
    if config.getoption("--local"):
        set_local()
    if config.getoption("--direct-python"):
        set_python_direct()
    set_logger()
    runtime_capabilities.collect_capabilities()
    if config.getoption("--async"):
        set_async()
    add_service_settings()
    adjust_surfaces_for_missing_implementations()
    only_include_scenario_tests(items, config.getoption("--scenario"))
    skip_unsupported_tests(items)

    # make sure the network is connected before starting (this can happen with interrupted runs)
    if settings.test_module.capabilities.v2_connect_group:
        settings.test_module.wrapper_api.network_reconnect_sync()

    if getattr(config, "_origargs", None):
        adapter_config.logger("HORTON: starting run: {}".format(
            config._origargs))
    elif getattr(config, "invocation_params", None):
        adapter_config.logger("HORTON: starting run: {}".format(
            config.invocation_params.args))

    if config.getoption("--debug-container"):
        print("Debugging the container.  Removing all timeouts")
        adapter_config.default_api_timeout = 3600
        config._env_timeout = 0

    dump_object(settings)
def adjust_surfaces_for_missing_implementations():
    if (settings.test_module.language
            not in runtime_capabilities.language_has_service_client):
        settings.registry.adapter_address = "direct_rest"
        settings.service.adapter_address = "direct_rest"

    if (settings.test_module.language
            not in runtime_capabilities.language_has_leaf_device_client):
        settings.leaf_device.adapter_address = settings.friend_module.adapter_address
        settings.leaf_device.container_port = settings.friend_module.container_port
        settings.leaf_device.host_port = settings.friend_module.host_port
        settings.leaf_device.language = settings.friend_module.language
        # adapter has changed.  recollect capabilities.
        runtime_capabilities.collect_capabilities(settings.leaf_device)

    if (settings.test_module.language
            not in runtime_capabilities.language_has_full_device_client):
        settings.test_device.adapter_address = None