fix(test_abp_client): update test to match new non-Future implementation

shutdown() now clears pending requests directly instead of calling
cancel() on asyncio.Future instances.
This commit is contained in:
LIghtJUNction
2026-03-24 20:49:48 +08:00
parent 7e941c8487
commit 5f42d82293

View File

@@ -98,15 +98,12 @@ class TestAstrbotAbpClient:
@pytest.mark.asyncio
async def test_shutdown_cancels_pending_requests(self, abp_client):
"""shutdown should cancel any pending requests."""
"""shutdown should clear any pending requests."""
await abp_client.connect()
# Create a pending future
future = MagicMock(done=MagicMock(return_value=False))
future.cancel = MagicMock()
abp_client._pending_requests["req-1"] = future
# Add a pending request entry
abp_client._pending_requests["req-1"] = {"status": "pending"}
await abp_client.shutdown()
future.cancel.assert_called_once()
assert len(abp_client._pending_requests) == 0