from __future__ import annotations

import os


def pytest_addoption(parser):
    parser.addoption(
        "--full",
        action="store_true",
        default=False,
        help="run full Lost Cities JAX differential profile",
    )


def pytest_configure(config):
    config.addinivalue_line("markers", "slow: longer randomized Lost Cities JAX checks")


def game_count(config, env_name: str, local: int, ci: int, full: int) -> int:
    if env_name in os.environ:
        return int(os.environ[env_name])
    if config.getoption("--full"):
        return full
    if os.environ.get("CI"):
        return ci
    return local
