fix: mock asyncio.run in mirror test to prevent event loop destruction

asyncio.run() closes the event loop after execution, which breaks
subsequent tests using asyncio.get_event_loop() (test_send_image_file).
This commit is contained in:
0xbyt4
2026-03-09 00:20:19 +03:00
parent d0f84c0964
commit 0c3253a485

View File

@@ -54,11 +54,8 @@ class TestDeliverResultMirrorLogging:
mock_cfg = MagicMock()
mock_cfg.platforms = {Platform.TELEGRAM: pconfig}
async def fake_send(*args, **kwargs):
return None
with patch("gateway.config.load_gateway_config", return_value=mock_cfg), \
patch("tools.send_message_tool._send_to_platform", new=fake_send), \
patch("asyncio.run", return_value=None), \
patch("gateway.mirror.mirror_to_session", side_effect=ConnectionError("network down")):
job = {
"id": "test-job",