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.
This commit is contained in:
@@ -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("mempalace.room_detector_local.detect_rooms_local"),
|
||||||
patch("builtins.open", MagicMock()),
|
patch("builtins.open", MagicMock()),
|
||||||
patch("mempalace.cli._maybe_run_mine_after_init"),
|
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"
|
mock_register.return_value = "/tmp/known_entities.json"
|
||||||
cmd_init(args)
|
cmd_init(args)
|
||||||
|
|||||||
Reference in New Issue
Block a user