def pytest_collection_modifyitems()

in conftest.py [0:0]


def pytest_collection_modifyitems(config, items):
    if config.getoption("--run-web-tests"):
        return
    skip_web = pytest.mark.skip(reason="Need --run-web-tests option to run")
    for item in items:
        if "web_dependency" in item.keywords:
            item.add_marker(skip_web)