Skip to content

Commit d84b0fb

Browse files
committed
fix: format pyrefly.py and update capability tests to use docker images
1 parent a82037d commit d84b0fb

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/lsp_client/clients/pyrefly.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
from lsp_client.server.local import LocalServer
4242
from lsp_client.utils.types import lsp_type
4343

44-
PyreflyDockerServer = partial(
45-
DockerServer, image="docker.io/lspcontainers/pyrefly"
46-
)
44+
PyreflyDockerServer = partial(DockerServer, image="docker.io/lspcontainers/pyrefly")
4745

4846

4947
@define

tests/test_capabilities.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,29 @@
33
import pytest
44

55
from lsp_client import LSPClient
6-
from lsp_client.clients import local_clients
6+
from lsp_client.clients import (
7+
PyreflyClient,
8+
PyrightClient,
9+
RustAnalyzerClient,
10+
TypescriptClient,
11+
)
12+
from lsp_client.server.docker import DockerServer
713
from lsp_client.utils.inspect import inspect_capabilities
814

915

1016
@pytest.mark.asyncio
1117
@pytest.mark.parametrize(
12-
"client_cls",
13-
local_clients,
18+
"client_cls,image",
19+
[
20+
(PyrightClient, "ghcr.io/observerw/lsp-client/pyright:latest"),
21+
(RustAnalyzerClient, "ghcr.io/observerw/lsp-client/rust-analyzer:latest"),
22+
(TypescriptClient, "ghcr.io/observerw/lsp-client/typescript:latest"),
23+
(PyreflyClient, "ghcr.io/observerw/lsp-client/pyrefly:latest"),
24+
],
1425
)
15-
async def test_capabilities_match(client_cls: type[LSPClient]):
16-
# instantiate the client directly to get its default server
17-
client = client_cls()
18-
server = client.server
26+
async def test_capabilities_match(client_cls: type[LSPClient], image: str):
27+
# Use DockerServer for testing to ensure environment consistency
28+
server = DockerServer(image=image, mounts=[])
1929

2030
mismatches = []
2131
async for result in inspect_capabilities(server, client_cls):
@@ -26,5 +36,6 @@ async def test_capabilities_match(client_cls: type[LSPClient]):
2636

2737
if mismatches:
2838
pytest.fail(
29-
f"Capability mismatch for {client_cls.__name__}:\n" + "\n".join(mismatches)
39+
f"Capability mismatch for {client_cls.__name__} in container {image}:\n"
40+
+ "\n".join(mismatches)
3041
)

0 commit comments

Comments
 (0)