Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.9 KB
Raw Blame
"""
Testing and CI environment settings.

These settings control test mode behavior and CI/testing flags.
"""

import os
from ..env_settings import BooleanSetting


# External environment variables (not LDR-prefixed, set by external systems)
# These are read directly since we don't control them
CI = os.environ.get("CI", "false").lower() in ("true", "1", "yes")
GITHUB_ACTIONS = os.environ.get("GITHUB_ACTIONS", "false").lower() in (
    "true",
    "1",
    "yes",
)
TESTING = os.environ.get("TESTING", "false").lower() in ("true", "1", "yes")


def testing_with_mocks() -> bool:
    """True when the suite is in mock-only mode and must not touch the network.

    ``tests/conftest.py`` defaults ``LDR_TESTING_WITH_MOCKS`` to ``"true"`` for
    the whole run; the dedicated journal-data-integration workflow sets it to
    ``"false"`` to opt into live network.

    A **function**, not a module-level constant like ``CI`` / ``TESTING``
    above, and that difference is load-bearing: those freeze at import, whereas
    this is read by call sites that tests toggle with ``monkeypatch.setenv``
    after import. A constant here would silently ignore the toggle.

    It lives in this subtree rather than next to its callers because
    ``.pre-commit-hooks/check-env-vars.py`` requires ``LDR_*`` variables to be
    read through the settings layer, and it cannot go through
    ``SettingsManager`` itself -- one of its callers is the guard on *opening
    the settings database*, so consulting settings to answer it is circular.

    Unset (production) reads false, so no production path is gated.
    """
    return os.environ.get("LDR_TESTING_WITH_MOCKS", "").lower() == "true"


# LDR Testing settings (our application's test configuration)
TESTING_SETTINGS = [
    BooleanSetting(
        key="testing.test_mode",
        description="Enable test mode (adds delays for testing concurrency)",
        default=False,
    ),
]