Skip to content

Commit c88cbd3

Browse files
committed
test: skip capability tests if docker is not available
1 parent d84b0fb commit c88cbd3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_capabilities.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import annotations
22

3+
import shutil
4+
import subprocess
5+
36
import pytest
47

58
from lsp_client import LSPClient
@@ -13,6 +16,17 @@
1316
from lsp_client.utils.inspect import inspect_capabilities
1417

1518

19+
def has_docker() -> bool:
20+
if not shutil.which("docker"):
21+
return False
22+
try:
23+
subprocess.run(["docker", "info"], check=True, capture_output=True)
24+
return True
25+
except subprocess.CalledProcessError:
26+
return False
27+
28+
29+
@pytest.mark.skipif(not has_docker(), reason="Docker not available")
1630
@pytest.mark.asyncio
1731
@pytest.mark.parametrize(
1832
"client_cls,image",

0 commit comments

Comments
 (0)