Ejemplo n.º 1
0
def pytest_collection_modifyitems(config, items):
    if config.getoption("--page-layout"):
        return
    skip_page_layout = pytest.mark.skip(
        reason="need --page-layout option to run page layout tests")
    for item in items:
        if "pagelayout" in item.keywords:
            item.add_marker(skip_page_layout)
Ejemplo n.º 2
0
def pytest_collection_modifyitems(config, items):
    if not config.getoption("--no-db"):
        # --no-db not given in cli: do not skip tests that require database
        return

    skip_db = pytest.mark.skip(reason="need --no-db option removed to run")
    for item in items:
        if "db" in item.keywords:
            item.add_marker(skip_db)
Ejemplo n.º 3
0
def pytest_collection_modifyitems(config, items):
    if config.getoption("--page-layout"):
        return
    skip_page_layout = pytest.mark.skip(
        reason="need --page-layout option to run page layout tests"
    )
    for item in items:
        if "pagelayout" in item.keywords:
            item.add_marker(skip_page_layout)
Ejemplo n.º 4
0
def pytest_configure(config):
    """Allow plugins and conftest files to perform initial configuration.

    This hook is called for every plugin and initial conftest file after command line
    options have been parsed.

    After that, the hook is called for other conftest files as they are imported.
    """
    sys.is_running_under_travis = "TRAVIS" in os.environ
    sys.is_running_under_pytest = True

    tests.util.sample.options = {
        "error": config.getoption("--sample-error"),
    }

    # Only accept error messages from loggers that are noisy at debug.
    logging.getLogger('django.db.backends.schema').setLevel(logging.ERROR)
Ejemplo n.º 5
0
def pytest_collection_modifyitems(config, items):
    """
    Support for running tests with component tags.
    Report all test component markers to mongo_reporter.
    """
    only_param = config.getoption("only_with_param")
    if only_param is not None:
        items[:] = [i for i in items if only_param in i.name]

    if config.option.collectonly:
        _log_skip_statistic(items)

    all_component_markers = []
    for item in items:
        components = item.get_marker("components")
        if components is not None:
            all_component_markers.extend(components)
            for component in components.args:
                item.add_marker(component.replace("-", "_"))

    all_components = []
    for marker in all_component_markers:
        all_components.extend(list(marker.args))
    mongo_reporter.report_components(all_components)