test: make context-failure regressions deterministic and simplify alarm log handling

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-08-26 05:07:35 +00:00
committed by GitHub
co-authored by genichin
parent 1ca9e60c98
commit 75406af970
2 changed files with 22 additions and 19 deletions
+2 -5
View File
@@ -17,7 +17,6 @@ where no broker connection exists. In that case publish_alarm() logs and skips.
from __future__ import annotations
import logging
import sys
from datetime import datetime, timedelta, timezone
from trex_core.adapters.messaging.topology import alarm_routing_key
@@ -91,11 +90,9 @@ class AlarmEmitter:
code, title,
)
return False
except Exception: # noqa: BLE001 — alarm must never crash the caller
exc = sys.exc_info()[1]
exc_name = type(exc).__name__ if exc is not None else "Exception"
except Exception as exc: # noqa: BLE001 — alarm must never crash the caller
_log.error(
"alarm publish failed: code=%s title=%s error_type=%s",
code, title, exc_name,
code, title, type(exc).__name__,
)
return False