main() delegates to asyncio.run(serve(...)) when no CLI subcommand is given.
(argv: list[str], monkeypatch: pytest.MonkeyPatch)
| 18 | ], |
| 19 | ) |
| 20 | def test_main_calls_asyncio_run(argv: list[str], monkeypatch: pytest.MonkeyPatch) -> None: |
| 21 | """main() delegates to asyncio.run(serve(...)) when no CLI subcommand is given.""" |
| 22 | monkeypatch.setattr(sys, "argv", argv) |
| 23 | with patch("asyncio.run") as mock_run: |
| 24 | mock_run.side_effect = lambda coro: coro.close() |
| 25 | main() |
| 26 | mock_run.assert_called_once() |
| 27 | |
| 28 | |
| 29 | @pytest.mark.parametrize( |