From 021d3eae94b750762b06081e94f665a1fe062217 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Mon, 25 May 2026 21:57:30 +0000 Subject: [PATCH 1/2] fix(tests): eliminate AsyncMock unawaited-coroutine warnings in slack tests Set explicit return_value dicts on AsyncMock client methods (users_info, conversations_replies, chat_postMessage) so that production code calling .get() on the mock results does not generate nested AsyncMocks whose methods become unawaited coroutines. Co-Authored-By: Claude Opus 4.7 --- tests/gateway/test_slack.py | 21 ++++++++++++++++++++ tests/gateway/test_slack_approval_buttons.py | 11 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/tests/gateway/test_slack.py b/tests/gateway/test_slack.py index 0eebf49c..e83b36dd 100644 --- a/tests/gateway/test_slack.py +++ b/tests/gateway/test_slack.py @@ -77,6 +77,14 @@ def adapter(): # Mock the Slack app client a._app = MagicMock() a._app.client = AsyncMock() + # Default return values for methods called during _handle_slack_message + # to avoid "coroutine 'AsyncMockMixin._execute_mock_call' was never awaited" + # when the code does result.get(...) on a bare AsyncMock. + a._app.client.users_info = AsyncMock( + return_value={"user": {"name": "testuser", "real_name": "Test User"}} + ) + a._app.client.conversations_replies = AsyncMock(return_value={"messages": []}) + a._app.client.chat_postMessage = AsyncMock(return_value={"ts": "1234.5678"}) a._bot_user_id = "U_BOT" a._running = True # Capture events instead of processing them @@ -1860,6 +1868,13 @@ class TestThreadReplyHandling: a = SlackAdapter(config) a._app = MagicMock() a._app.client = AsyncMock() + # Default return values for methods called during _handle_slack_message + # to avoid "coroutine 'AsyncMockMixin._execute_mock_call' was never awaited" + # when the code does result.get(...) on a bare AsyncMock. + a._app.client.users_info = AsyncMock( + return_value={"user": {"name": "testuser", "real_name": "Test User"}} + ) + a._app.client.conversations_replies = AsyncMock(return_value={"messages": []}) a._bot_user_id = "U_BOT" a._team_bot_user_ids = {"T_TEAM": "U_BOT"} a._running = True @@ -2000,6 +2015,12 @@ class TestAssistantThreadLifecycle: a = SlackAdapter(config) a._app = MagicMock() a._app.client = AsyncMock() + # Default return values to avoid "coroutine 'AsyncMockMixin._execute_mock_call' + # was never awaited" when code does result.get(...) on a bare AsyncMock. + a._app.client.users_info = AsyncMock( + return_value={"user": {"name": "testuser", "real_name": "Test User"}} + ) + a._app.client.conversations_replies = AsyncMock(return_value={"messages": []}) a._bot_user_id = "U_BOT" a._team_bot_user_ids = {"T_TEAM": "U_BOT"} a._running = True diff --git a/tests/gateway/test_slack_approval_buttons.py b/tests/gateway/test_slack_approval_buttons.py index bc12d007..44f87f5f 100644 --- a/tests/gateway/test_slack_approval_buttons.py +++ b/tests/gateway/test_slack_approval_buttons.py @@ -56,6 +56,14 @@ def _make_adapter(): adapter._team_clients = {"T1": AsyncMock()} adapter._team_bot_user_ids = {"T1": "U_BOT"} adapter._channel_team = {"C1": "T1"} + # Default return values to avoid "coroutine 'AsyncMockMixin._execute_mock_call' + # was never awaited" when code does result.get(...) on a bare AsyncMock. + adapter._team_clients["T1"].users_info = AsyncMock( + return_value={"user": {"name": "testuser", "real_name": "Test User"}} + ) + adapter._team_clients["T1"].conversations_replies = AsyncMock( + return_value={"messages": []} + ) return adapter @@ -411,6 +419,9 @@ class TestSlackThreadContext: adapter = _make_adapter() # Add a second workspace with a different bot user id adapter._team_clients["T2"] = AsyncMock() + adapter._team_clients["T2"].users_info = AsyncMock( + return_value={"user": {"name": "testuser", "real_name": "Test User"}} + ) adapter._team_bot_user_ids = {"T1": "U_BOT_T1", "T2": "U_BOT_T2"} adapter._bot_user_id = "U_BOT_T1" adapter._channel_team["C2"] = "T2" -- 2.52.0 From 3b2f9861d476226b7b84151cbb2c2bb966ad1909 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Mon, 25 May 2026 23:17:56 +0000 Subject: [PATCH 2/2] chore: re-trigger CI -- 2.52.0