Skip to content

Commit 99e235f

Browse files
committed
test: cover cli run without transport
1 parent 4ac189e commit 99e235f

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/cli/test_utils.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,19 @@ def test_parse_file_exit_on_dir(tmp_path: Path):
4444
_parse_file_path(str(dir_path))
4545

4646

47-
def test_run_configures_logging_at_cli_entrypoint(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
47+
@pytest.mark.parametrize(
48+
("transport", "expected_kwargs"),
49+
[
50+
(None, {}),
51+
("stdio", {"transport": "stdio"}),
52+
],
53+
)
54+
def test_run_configures_logging_at_cli_entrypoint(
55+
monkeypatch: pytest.MonkeyPatch,
56+
tmp_path: Path,
57+
transport: str | None,
58+
expected_kwargs: dict[str, str],
59+
):
4860
"""The CLI owns process logging setup; importing or constructing the server does not."""
4961
file = tmp_path / "server.py"
5062
file.write_text("server = object()")
@@ -71,11 +83,11 @@ def fake_configure_logging(level: str) -> None:
7183
fake_configure_logging,
7284
)
7385

74-
run(f"{file}:server", transport="stdio")
86+
run(f"{file}:server", transport=transport)
7587

7688
assert calls == [
7789
("logging", "DEBUG"),
78-
("run", {"transport": "stdio"}),
90+
("run", expected_kwargs),
7991
]
8092

8193

0 commit comments

Comments
 (0)