From 8104f400f848c6208f52cc782495390384eea6b6 Mon Sep 17 00:00:00 2001 From: Teknium Date: Thu, 9 Apr 2026 22:49:10 -0700 Subject: [PATCH] test: disable text batching in existing adapter tests Set _text_batch_delay_seconds = 0 on test adapter fixtures so messages dispatch immediately (bypassing async batching). This preserves the existing synchronous assertion patterns while the batching logic is tested separately in test_text_batching.py. --- tests/gateway/test_discord_channel_controls.py | 1 + tests/gateway/test_discord_free_response.py | 1 + tests/gateway/test_discord_slash_commands.py | 1 + tests/gateway/test_matrix_mention.py | 1 + tests/gateway/test_wecom.py | 2 ++ 5 files changed, 6 insertions(+) diff --git a/tests/gateway/test_discord_channel_controls.py b/tests/gateway/test_discord_channel_controls.py index d71304d09..dc7971529 100644 --- a/tests/gateway/test_discord_channel_controls.py +++ b/tests/gateway/test_discord_channel_controls.py @@ -81,6 +81,7 @@ def adapter(monkeypatch): config = PlatformConfig(enabled=True, token="fake-token") adapter = DiscordAdapter(config) adapter._client = SimpleNamespace(user=SimpleNamespace(id=999)) + adapter._text_batch_delay_seconds = 0 # disable batching for tests adapter.handle_message = AsyncMock() return adapter diff --git a/tests/gateway/test_discord_free_response.py b/tests/gateway/test_discord_free_response.py index 09d696840..bc63c14f5 100644 --- a/tests/gateway/test_discord_free_response.py +++ b/tests/gateway/test_discord_free_response.py @@ -91,6 +91,7 @@ def adapter(monkeypatch): config = PlatformConfig(enabled=True, token="fake-token") adapter = DiscordAdapter(config) adapter._client = SimpleNamespace(user=SimpleNamespace(id=999)) + adapter._text_batch_delay_seconds = 0 # disable batching for tests adapter.handle_message = AsyncMock() return adapter diff --git a/tests/gateway/test_discord_slash_commands.py b/tests/gateway/test_discord_slash_commands.py index 6c4911de8..f7ed64639 100644 --- a/tests/gateway/test_discord_slash_commands.py +++ b/tests/gateway/test_discord_slash_commands.py @@ -62,6 +62,7 @@ def adapter(): fetch_channel=AsyncMock(), user=SimpleNamespace(id=99999, name="HermesBot"), ) + adapter._text_batch_delay_seconds = 0 # disable batching for tests return adapter diff --git a/tests/gateway/test_matrix_mention.py b/tests/gateway/test_matrix_mention.py index dee7586d2..4c689fa10 100644 --- a/tests/gateway/test_matrix_mention.py +++ b/tests/gateway/test_matrix_mention.py @@ -44,6 +44,7 @@ def _make_adapter(tmp_path=None): }, ) adapter = MatrixAdapter(config) + adapter._text_batch_delay_seconds = 0 # disable batching for tests adapter.handle_message = AsyncMock() adapter._startup_ts = time.time() - 10 # avoid startup grace filter return adapter diff --git a/tests/gateway/test_wecom.py b/tests/gateway/test_wecom.py index 418a4b622..0540146d7 100644 --- a/tests/gateway/test_wecom.py +++ b/tests/gateway/test_wecom.py @@ -508,6 +508,7 @@ class TestInboundMessages: from gateway.platforms.wecom import WeComAdapter adapter = WeComAdapter(PlatformConfig(enabled=True)) + adapter._text_batch_delay_seconds = 0 # disable batching for tests adapter.handle_message = AsyncMock() adapter._extract_media = AsyncMock(return_value=(["/tmp/test.png"], ["image/png"])) @@ -539,6 +540,7 @@ class TestInboundMessages: from gateway.platforms.wecom import WeComAdapter adapter = WeComAdapter(PlatformConfig(enabled=True)) + adapter._text_batch_delay_seconds = 0 # disable batching for tests adapter.handle_message = AsyncMock() adapter._extract_media = AsyncMock(return_value=([], []))