mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 01:40:15 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user