Example #1
0
def pytest_configure(config: _pytest.config.Config) -> None:
    """
    Loads the test context since we are no longer using run.py
    """
    logger.info("Starting configuration")

    # Monkey patch ssl so we do not verify ssl certs
    _create_unverified_https_context = ssl._create_unverified_context

    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

    url = config.getoption("url")
    if not url.endswith("/"):
        url += "/"

    # Define markers
    config.addinivalue_line("markers", "serial")
    config.addinivalue_line("markers", "skip_production")
    config.addinivalue_line("markers", "manual_batch_review")

    name_server_ip = retrieve_resolver(config.getoption("dns_ip"))
    VinylDNSTestContext.configure(
        name_server_ip=name_server_ip,
        resolver_ip=retrieve_resolver(
            config.getoption("resolver_ip", name_server_ip) or name_server_ip),
        zone=config.getoption("dns_zone"),
        key_name=config.getoption("dns_key_name"),
        key=config.getoption("dns_key"),
        url=url,
        teardown=config.getoption("teardown").lower() == "true",
        key_algo=config.getoption("dns_key_algo"),
        enable_safety_check=config.getoption("enable_safety_check"))
Example #2
0
def pytest_report_header(config: _pytest.config.Config) -> str:
    """
    Overrides the test result header like we do in pyfunc test
    """
    logger.debug("testing!")
    header = "Testing against environment " + config.getoption("environment")
    header += "\nURL: " + config.getoption("url")
    header += "\nRunning from directory " + os.getcwd()
    header += "\nTest shim directory " + os.path.dirname(__file__)
    header += "\nDNS IP: " + config.getoption("dns_ip")
    return header
Example #3
0
def pytest_configure(config: _pytest.config.Config) -> None:
    qt_api_string = config.getoption("--qt-api")
    qt_api = ssst.cli.qt_api_cli_names[qt_api_string]

    if qt_api is not None:  # pragma: no branch
        ssst._utilities.configure_qt_wrapper(api=qt_api)

    # subprocessing to avoid import of qts, even in subprocessed tests
    script_path = ssst._utilities.script_path(name="ssst")
    subprocess.run([os.fspath(script_path), "uic"], check=True)
Example #4
0
def pytest_report_collectionfinish(config: config.Config,
                                   startdir: py.path.local,
                                   items: Sequence[nodes.Item]) -> List[str]:
    '''

    '''
    driver_name: str = config.getoption('driver', 'chrome').lower()
    asserts = "ON" if driver_name == "chrome" else "OFF"
    return [
        "",
        f"Bokeh selenium tests using {driver_name!r} driver (no-console-error assertions: {asserts})"
    ]
Example #5
0
def pytest_collection_modifyitems(items, config):
    picked_plugin = config.getoption("picked")
    if not picked_plugin:
        return

    picked_files, picked_folders = _afected_tests()
    _display_afected_tests(config, picked_files, picked_folders)

    to_be_tested = []
    for item in items:
        location = item.location[0]
        if location in picked_files:
            to_be_tested.append(item)
        else:
            for folder in picked_folders:
                if location.startswith(folder):
                    to_be_tested.append(item)
                    break
    items[:] = to_be_tested