A pytest run on prod was sending REAL Telegram messages to Slava: some tests (e.g. test_webhook_dedup advancing a stage) reach notify_stage_change -> send_telegram, which read the live .env token/chat_id and actually POSTed. Add an autouse fixture stubbing send_telegram to a no-op for every test. Patch the SOURCE src.notifications.send_telegram (covers all notify_* helpers and the many modules that do a local from .notifications import send_telegram inside functions) AND src.stage_engine.send_telegram (module-level binding, would not be intercepted by the source patch alone). webhooks/plane, launcher, queue_worker are patched defensively with raising=False. Verified: full suite run with FAKE telegram creds + an un-swallowable httpx.post trip-wire (BaseException, so send_telegram except Exception can not hide it) shows ZERO calls to api.telegram.org. Without the fixture the trip-wire fires, proving the guard is real.
1.9 KiB
1.9 KiB