95a14bb8d2
Silences pylint W1510 / ruff PLW1510 across the codebase. The choice at each site reflects existing intent: - check=True where the caller implicitly trusts success (docker ps / network ls returning stdout, docker build, exec chown/chmod inside provisioners). - check=False where the caller inspects .returncode (race-retry on docker run, pipelock sidecar lifecycle, network plumbing, exec_claude propagating the session's exit code, best-effort cleanup paths). No behavior change; check= defaults to False so the False sites are semantically identical.
26 lines
571 B
Python
26 lines
571 B
Python
"""Docker availability check used by integration tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
|
|
|
|
def docker_available() -> bool:
|
|
if shutil.which("docker") is None:
|
|
return False
|
|
return (
|
|
subprocess.run(
|
|
["docker", "info"],
|
|
stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.DEVNULL,
|
|
check=False,
|
|
).returncode
|
|
== 0
|
|
)
|
|
|
|
|
|
def skip_unless_docker(reason: str = "docker unreachable"):
|
|
return unittest.skipUnless(docker_available(), reason)
|