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:
parent
d0f84c0964
commit
0c3253a485
1 changed files with 1 additions and 4 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue