mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-19 02:12:46 +08:00
test: add RuntimeError tests for LSP client not connected cases
- Add test_lsp_client_send_request_not_connected - Add test_lsp_client_send_notification_not_connected - Mark 6.2 and 7.2 tasks complete in tasks.md
This commit is contained in:
Binary file not shown.
@@ -83,4 +83,20 @@ async def test_lsp_client_send_notification():
|
||||
await client.send_notification("custom/notify", {"data": "test"})
|
||||
|
||||
finally:
|
||||
await client.shutdown()
|
||||
await client.shutdown()
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_lsp_client_send_request_not_connected():
|
||||
"""Test LSP client raises RuntimeError when sending request while not connected."""
|
||||
client = AstrbotLspClient()
|
||||
with pytest.raises(RuntimeError, match="LSP client not connected"):
|
||||
await client.send_request("test", {})
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_lsp_client_send_notification_not_connected():
|
||||
"""Test LSP client raises RuntimeError when sending notification while not connected."""
|
||||
client = AstrbotLspClient()
|
||||
with pytest.raises(RuntimeError, match="LSP client not connected"):
|
||||
await client.send_notification("test", {})
|
||||
Reference in New Issue
Block a user