Skip to content

Commit 41a7fca

Browse files
committed
test: remove obsolete pragma and isolate session establishment in tests
1 parent 4b20b7b commit 41a7fca

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎src/mcp/shared/_httpx_utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create_mcp_http_client(
5959
kwargs: dict[str, Any] = {"timeout": timeout}
6060
if headers is not None:
6161
kwargs["headers"] = headers
62-
if auth is not None: # pragma: no cover
62+
if auth is not None:
6363
kwargs["auth"] = auth
6464
return httpx2.AsyncClient(**kwargs)
6565

‎tests/client/test_session_group.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,10 @@ def record_stream_client(*args: Any, **kwargs: Any) -> mock.AsyncMock:
565565
mock_session_cls.return_value = mock_session_cm
566566

567567
group = ClientSessionGroup()
568-
async with group:
569-
await group.connect_to_server(params_a)
570-
await group.connect_to_server(params_b)
568+
async with contextlib.AsyncExitStack() as stack:
569+
group._exit_stack = stack
570+
await group._establish_session(params_a, ClientSessionParameters())
571+
await group._establish_session(params_b, ClientSessionParameters())
571572

572573
assert len(recorded_clients) == 2
573574
assert recorded_clients[0].auth is auth_a

0 commit comments

Comments
 (0)