73ce3ad0df
Env-driven Config fails fast on missing required values; LOCAL_MODE relaxes the K8s-specific knobs so the bot can run from a plain docker container against a bind-mounted oauth-tokens dir. Entrypoint wires together token refresh, usage poll, alert computation, optional armed cold-start message, E2EE Matrix send, and atomic state persistence. Adds a pytest -m live smoke test that hits the real /api/oauth/usage endpoint, skipped by default so CI stays offline.
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Pytest config.
|
|
|
|
Registers the `live` marker (tests that hit the real Anthropic API) and skips
|
|
those tests unless `pytest -m live` is explicitly used. Keeps CI fast and offline
|
|
while letting humans run a real smoke test locally.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
def pytest_configure(config: pytest.Config) -> None:
|
|
config.addinivalue_line(
|
|
"markers",
|
|
"live: hits the live Anthropic /api/oauth/usage endpoint. "
|
|
"Skipped unless run via `pytest -m live` with LIVE_TOKENS_DIR set.",
|
|
)
|
|
|
|
|
|
def pytest_collection_modifyitems(
|
|
config: pytest.Config, items: list[pytest.Item]
|
|
) -> None:
|
|
# If the user passed -m live, run those and don't auto-skip.
|
|
selected = config.getoption("-m", default="") or ""
|
|
if "live" in selected:
|
|
return
|
|
|
|
skip_live = pytest.mark.skip(
|
|
reason="live API test; run with `pytest -m live` (needs LIVE_TOKENS_DIR)"
|
|
)
|
|
for item in items:
|
|
if "live" in item.keywords:
|
|
item.add_marker(skip_live)
|