From cfca40c5ec1d0e3de848d72d2d09d416cd3a3aa8 Mon Sep 17 00:00:00 2001 From: igorls <4753812+igorls@users.noreply.github.com> Date: Mon, 27 Apr 2026 03:14:02 -0300 Subject: [PATCH] test(cli): mock _run_pass_zero so wing-name test survives corpus-origin cmd_init now invokes ``_run_pass_zero`` unconditionally (#1221, #1223 landed on develop after this PR's branch point). The pass reads sample content via ``builtins.open``; with that mocked to MagicMock, the downstream ``"\\n\\n".join(samples)`` in ``corpus_origin.detect_origin_heuristic`` raises ``TypeError: expected str instance, MagicMock found``. This test only cares about the wing-slug write to the registry, so stub the pass-zero call directly rather than try to satisfy its full sample-gathering contract. --- tests/test_cli.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 02dca19..af7b39d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -163,6 +163,11 @@ def test_cmd_init_normalizes_wing_name_for_topics_registry(mock_config_cls, tmp_ patch("mempalace.room_detector_local.detect_rooms_local"), patch("builtins.open", MagicMock()), patch("mempalace.cli._maybe_run_mine_after_init"), + # Pass-zero corpus-origin detection runs unconditionally inside + # cmd_init now (#1221 / #1223). It accesses MempalaceConfig fields + # that don't survive MagicMock stringification, so stub it out — + # this test only cares about the wing-slug write to the registry. + patch("mempalace.cli._run_pass_zero", return_value=None), ): mock_register.return_value = "/tmp/known_entities.json" cmd_init(args)