style: pass explicit check= to every subprocess.run call
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.
This commit is contained in:
@@ -15,6 +15,7 @@ def docker_available() -> bool:
|
||||
["docker", "info"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=False,
|
||||
).returncode
|
||||
== 0
|
||||
)
|
||||
|
||||
@@ -27,6 +27,7 @@ class TestPipelockImage(unittest.TestCase):
|
||||
["docker", "pull", PIPELOCK_IMAGE],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
raise unittest.SkipTest(f"could not pull {PIPELOCK_IMAGE}")
|
||||
@@ -34,7 +35,7 @@ class TestPipelockImage(unittest.TestCase):
|
||||
def test_binary_runs(self):
|
||||
result = subprocess.run(
|
||||
["docker", "run", "--rm", PIPELOCK_IMAGE, "--version"],
|
||||
capture_output=True, text=True,
|
||||
capture_output=True, text=True, check=False,
|
||||
)
|
||||
out = result.stdout + result.stderr
|
||||
self.assertRegex(out, r"[Pp]ipelock|2\.[0-9]+\.[0-9]+")
|
||||
|
||||
@@ -43,6 +43,7 @@ class TestDryRunPlan(unittest.TestCase):
|
||||
env=env,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
0, result.returncode,
|
||||
@@ -83,6 +84,7 @@ class TestDryRunPlan(unittest.TestCase):
|
||||
["docker", "network", "ls", "--format", "{{.Name}}"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True,
|
||||
)
|
||||
return sum(1 for n in result.stdout.splitlines() if n.startswith("claude-bottle"))
|
||||
|
||||
@@ -91,6 +93,7 @@ class TestDryRunPlan(unittest.TestCase):
|
||||
["docker", "ps", "-a", "--format", "{{.Names}}"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True,
|
||||
)
|
||||
return sum(1 for n in result.stdout.splitlines() if n.startswith("claude-bottle"))
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class TestOrphanCleanup(unittest.TestCase):
|
||||
["docker", "network", "rm", n],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=False,
|
||||
)
|
||||
|
||||
def test_remove_missing_is_noop(self):
|
||||
@@ -51,7 +52,7 @@ class TestOrphanCleanup(unittest.TestCase):
|
||||
|
||||
nets = subprocess.run(
|
||||
["docker", "network", "ls", "--format", "{{.Name}}"],
|
||||
capture_output=True, text=True,
|
||||
capture_output=True, text=True, check=True,
|
||||
).stdout.splitlines()
|
||||
self.assertIn(self.internal_name, nets)
|
||||
self.assertIn(self.egress_name, nets)
|
||||
@@ -61,7 +62,7 @@ class TestOrphanCleanup(unittest.TestCase):
|
||||
|
||||
nets_after = subprocess.run(
|
||||
["docker", "network", "ls", "--format", "{{.Name}}"],
|
||||
capture_output=True, text=True,
|
||||
capture_output=True, text=True, check=True,
|
||||
).stdout.splitlines()
|
||||
self.assertNotIn(self.internal_name, nets_after)
|
||||
self.assertNotIn(self.egress_name, nets_after)
|
||||
|
||||
@@ -46,6 +46,7 @@ class TestPipelockSidecarSmoke(unittest.TestCase):
|
||||
["docker", "pull", CURL_IMAGE],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
raise unittest.SkipTest(f"could not pull {CURL_IMAGE}")
|
||||
@@ -104,6 +105,7 @@ class TestPipelockSidecarSmoke(unittest.TestCase):
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60,
|
||||
check=False,
|
||||
)
|
||||
self.assertEqual(
|
||||
0, probe.returncode,
|
||||
|
||||
@@ -38,6 +38,7 @@ class TestStartFormatFlag(unittest.TestCase):
|
||||
env=env,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
self.assertNotEqual(0, result.returncode)
|
||||
self.assertIn(
|
||||
|
||||
Reference in New Issue
Block a user