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:
LIghtJUNction
2026-03-24 17:17:03 +08:00
parent bf19777fe4
commit dbeb104600
2 changed files with 17 additions and 1 deletions

View File

@@ -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", {})