"""Shared fixtures for end-to-end tests."""

from __future__ import annotations

import os

import pytest


def pytest_collection_modifyitems(
    config: pytest.Config,
    items: list[pytest.Item],
) -> None:
    """Skip all E2E tests unless CODEFLASH_END_TO_END is set."""
    if os.getenv("CODEFLASH_END_TO_END"):
        return

    skip = pytest.mark.skip(
        reason="E2E tests require CODEFLASH_END_TO_END=1",
    )
    for item in items:
        if "/e2e/" in str(item.fspath):
            item.add_marker(skip)
