import pytest


@pytest.fixture(autouse=True)
def _no_real_llm(monkeypatch):
    """Safety net: no test should reach the real arbiter.

    If a test constructs an LLM client from env without mocking, point it at a
    closed local port with a 1s timeout so the call fails fast instead of
    hanging on the production 300s timeout (which looks like a stalled suite).
    Tests that exercise the LLM patch it at the function level, which overrides
    these env defaults.
    """
    monkeypatch.setenv("GOODNEWS_LLM_BASE_URL", "http://127.0.0.1:1/v1")
    monkeypatch.setenv("GOODNEWS_LLM_TIMEOUT", "1")
    monkeypatch.delenv("GOODNEWS_LLM_API_KEY", raising=False)
