Skip to content

Commit 7046e62

Browse files
Fix test v2
1 parent 1f405db commit 7046e62

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/test_main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,26 @@ def fake_run(coro):
274274
assert captured["server_name"] == "custom"
275275

276276

277-
def test_single_server_mcp_config_rejects_multiple_servers_via_cli(runner: CliRunner) -> None:
277+
def test_single_server_mcp_config_rejects_multiple_servers_via_cli(
278+
runner: CliRunner, monkeypatch: pytest.MonkeyPatch
279+
) -> None:
278280
config_json = (
279281
'{"mcpServers": {'
280282
'"weather": {"command": "uvx", "args": ["mcp-weather"]}, '
281283
'"calendar": {"command": "uvx", "args": ["mcp-calendar"]}'
282284
"}}"
283285
)
286+
async_main_called = False
287+
288+
async def fake_async_main(**kwargs: Any) -> None:
289+
nonlocal async_main_called
290+
async_main_called = True
291+
292+
monkeypatch.setattr(main_module, "_async_main", fake_async_main)
284293
result = runner.invoke(app, [config_json])
285294

286295
assert result.exit_code != 0
287-
assert re.search(r"exactly one\s+server", _strip_ansi(result.output))
296+
assert async_main_called is False
288297

289298

290299
async def test_server_uses_mcp_config_transport_for_single_server_json(monkeypatch: pytest.MonkeyPatch) -> None:

0 commit comments

Comments
 (0)