from __future__ import annotations

import pytest


def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
    markexpr = (config.option.markexpr or "").strip()
    if markexpr:
        return

    skip_live = pytest.mark.skip(
        reason="Live tests run only via `pytest -m live` or `pytest -m live_create`."
    )
    for item in items:
        if "live" in item.keywords or "live_create" in item.keywords:
            item.add_marker(skip_live)
