The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(feishu): restore the loop default executor torn down by the dedup test
liuhao1024957a8a287c47
diff --git a/tests/gateway/test_feishu_sdk_executor.py b/tests/gateway/test_feishu_sdk_executor.pyindex 92126cdb76f..3666ebefc0f 100644--- a/tests/gateway/test_feishu_sdk_executor.py+++ b/tests/gateway/test_feishu_sdk_executor.py@@ -8,6 +8,7 @@ ThreadPoolExecutor and recreates it on demand if it has been shut down.Covers: #10849, #111020"""+import asyncioimport concurrent.futuresimport json@@ -60,7 +61,9 @@ async def test_run_blocking_executes_on_owned_pool():@pytest.mark.asyncio-async def test_is_duplicate_flush_survives_default_executor_teardown(tmp_path, monkeypatch):+async def test_is_duplicate_flush_survives_default_executor_teardown(+ tmp_path, monkeypatch+):"""The inbound dedup flush must not ride the loop's default executor.After the adapter's background event loop dies, its teardown shuts the@@ -73,8 +76,11 @@ async def test_is_duplicate_flush_survives_default_executor_teardown(tmp_path, mfrom gateway.config import PlatformConfigadapter = FeishuAdapter(PlatformConfig())+ loop = asyncio.get_running_loop()+ # Save/restore via the private slot: set_default_executor() rejects None, but the+ # pristine state is exactly "no default executor set yet" (lazy creation on first use).+ original_executor = loop._default_executortry:- loop = asyncio.get_running_loop()torn_down = concurrent.futures.ThreadPoolExecutor(max_workers=1)loop.set_default_executor(torn_down)torn_down.shutdown(wait=True)@@ -85,9 +91,10 @@ async def test_is_duplicate_flush_survives_default_executor_teardown(tmp_path, m# The dedup gate must still admit the message and flush it to disk.assert await adapter._is_duplicate("om_after_executor_teardown") is False- state = json.loads((tmp_path / "feishu_seen_message_ids.json").read_text(encoding="utf-8"))+ state = json.loads(+ (tmp_path / "feishu_seen_message_ids.json").read_text(encoding="utf-8")+ )assert "om_after_executor_teardown" in state["message_ids"]finally:+ loop._default_executor = original_executoradapter._shutdown_sdk_executor()--