main() routes to _cli_main when first argument is a CLI subcommand.
(
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
)
| 90 | |
| 91 | |
| 92 | def 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( |
nothing calls this directly
no test coverage detected