From eb9723027b9c16805a593663854d495c70d35dc2 Mon Sep 17 00:00:00 2001 From: didericis Date: Sat, 25 Jul 2026 12:01:01 -0400 Subject: [PATCH] test(macos): mock ensure_networks in TestInfraEnsureRunning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These four ensure_running() tests patched container_mod but not ensure_networks (imported into infra.py from .gateway), so they shelled out to the real Apple `container` CLI and errored on Linux (FileNotFoundError: 'container') — the dev + CI platform for this branch. Mock it so they're true unit tests, green on any platform. Co-Authored-By: Claude Opus 4.8 --- tests/unit/test_macos_infra.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/test_macos_infra.py b/tests/unit/test_macos_infra.py index a9845730..8c05ca9b 100644 --- a/tests/unit/test_macos_infra.py +++ b/tests/unit/test_macos_infra.py @@ -108,6 +108,7 @@ class TestInfraEnsureRunning(unittest.TestCase): svc = MacosInfraService(repo_root=Path("/r")) run = Mock() with patch(f"{_INFRA}.container_mod") as mod, \ + patch(f"{_INFRA}.ensure_networks"), \ patch(f"{_INFRA}.source_hash", return_value="h1"), \ patch.object(svc, "ensure_built"), \ patch.object(svc, "_run_orchestrator_container", run), \ @@ -125,6 +126,7 @@ class TestInfraEnsureRunning(unittest.TestCase): svc = MacosInfraService(repo_root=Path("/r")) run = Mock() with patch(f"{_INFRA}.container_mod") as mod, \ + patch(f"{_INFRA}.ensure_networks"), \ patch(f"{_INFRA}.source_hash", return_value="h2"), \ patch.object(svc, "ensure_built"), \ patch.object(svc, "_run_orchestrator_container", run), \ @@ -140,6 +142,7 @@ class TestInfraEnsureRunning(unittest.TestCase): svc = MacosInfraService(repo_root=Path("/r")) run = Mock() with patch(f"{_INFRA}.container_mod") as mod, \ + patch(f"{_INFRA}.ensure_networks"), \ patch(f"{_INFRA}.source_hash", return_value="h1"), \ patch.object(svc, "ensure_built"), \ patch.object(svc, "_run_orchestrator_container", run), \ @@ -154,6 +157,7 @@ class TestInfraEnsureRunning(unittest.TestCase): def test_never_healthy_raises(self) -> None: svc = MacosInfraService(repo_root=Path("/r")) with patch(f"{_INFRA}.container_mod") as mod, \ + patch(f"{_INFRA}.ensure_networks"), \ patch(f"{_INFRA}.source_hash", return_value="h1"), \ patch.object(svc, "ensure_built"), \ patch.object(svc, "_run_orchestrator_container"), \