From 943049733ed1cab023c82f3ca95d5334940d797e Mon Sep 17 00:00:00 2001 From: didericis Date: Thu, 16 Jul 2026 22:44:47 -0400 Subject: [PATCH] test(supervise): stub the client in cmd_supervise crash-logging tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `cmd_supervise` establishes the orchestrator client up front (since the HTTP-bridge move in 27fe03b), so these tests — which mock `curses.wrapper` to exercise the KeyboardInterrupt / Die / crash-log paths — only reached those paths when a live orchestrator happened to be reachable. On CI (none reachable) the up-front connect errored and `cmd_supervise` returned 1 before curses, failing all four. They passed locally only because a dev orchestrator was up. Stub `supervise_cli._client` in the class setUp so the tests isolate the post-connect behavior they actually cover, independent of environment. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01UoEZHDjv84ChoZbozQERhJ --- tests/unit/test_supervise_cli_crash_logging.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/test_supervise_cli_crash_logging.py b/tests/unit/test_supervise_cli_crash_logging.py index 05c5463..0f07f08 100644 --- a/tests/unit/test_supervise_cli_crash_logging.py +++ b/tests/unit/test_supervise_cli_crash_logging.py @@ -56,6 +56,15 @@ class _FakeHomeMixin: class TestCmdSuperviseErrorPaths(_FakeHomeMixin, unittest.TestCase): def setUp(self): self._setup_fake_home() + # `cmd_supervise` establishes the orchestrator client up front; these + # tests exercise the curses / crash-logging paths that run *after* + # that, so stub the client. Otherwise the outcome depends on whether a + # live orchestrator happens to be reachable (CI has none, so the + # up-front connect would error and short-circuit before curses). + client_patch = mock.patch.object( + supervise_cli, "_client", return_value=mock.MagicMock()) + client_patch.start() + self.addCleanup(client_patch.stop) def tearDown(self): self._teardown_fake_home()