MCPcopy
hub / github.com/MinishLab/semble / test_main_dispatches_to_cli

Function test_main_dispatches_to_cli

tests/test_cli.py:92–103  ·  view source on GitHub ↗

main() routes to _cli_main when first argument is a CLI subcommand.

(
    monkeypatch: pytest.MonkeyPatch,
    capsys: pytest.CaptureFixture[str],
)

Source from the content-addressed store, hash-verified

90
91
92def test_main_dispatches_to_cli(
93 monkeypatch: pytest.MonkeyPatch,
94 capsys: pytest.CaptureFixture[str],
95) -> None:
96 """main() routes to _cli_main when first argument is a CLI subcommand."""
97 chunk = make_chunk("def foo(): pass", "src/foo.py")
98 fake_index = MagicMock()
99 fake_index.search.return_value = [SearchResult(chunk=chunk, score=0.9)]
100 monkeypatch.setattr(sys, "argv", ["semble", "search", "query text", "/some/path"])
101 with patch("semble.cli.SembleIndex.from_path", return_value=fake_index):
102 main()
103 assert "query text" in capsys.readouterr().out
104
105
106@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

make_chunkFunction · 0.90
SearchResultClass · 0.90
mainFunction · 0.90

Tested by

no test coverage detected