Skip to content

Commit 396ae66

Browse files
committed
fix: add pragma no branch to streamable_http_client context managers
Coverage.py misreports the ->exit arc for nested async with on certain Python versions/platforms. Add # pragma: no branch to the four streamable_http_client context managers in the OAuth e2e tests.
1 parent 31e49dd commit 396ae66

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/server/mcpserver/test_multi_tenancy_oauth_e2e.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ async def test_alpha_sees_only_own_tools(starlette_app: Starlette):
293293
)
294294
async with http_client:
295295
# Use the MCP streamable HTTP client to establish a session
296-
async with streamable_http_client(
296+
async with streamable_http_client( # pragma: no branch
297297
url="http://localhost/mcp",
298298
http_client=http_client,
299299
) as (read_stream, write_stream):
@@ -317,7 +317,7 @@ async def test_beta_sees_only_own_tools(starlette_app: Starlette):
317317
headers={"Authorization": "Bearer token-beta"},
318318
)
319319
async with http_client:
320-
async with streamable_http_client(
320+
async with streamable_http_client( # pragma: no branch
321321
url="http://localhost/mcp",
322322
http_client=http_client,
323323
) as (read_stream, write_stream):
@@ -341,7 +341,7 @@ async def test_alpha_can_call_own_tool(starlette_app: Starlette):
341341
headers={"Authorization": "Bearer token-alpha"},
342342
)
343343
async with http_client:
344-
async with streamable_http_client(
344+
async with streamable_http_client( # pragma: no branch
345345
url="http://localhost/mcp",
346346
http_client=http_client,
347347
) as (read_stream, write_stream):
@@ -371,7 +371,7 @@ async def test_whoami_returns_correct_tenant(starlette_app: Starlette):
371371
headers={"Authorization": f"Bearer {token}"},
372372
)
373373
async with http_client:
374-
async with streamable_http_client(
374+
async with streamable_http_client( # pragma: no branch
375375
url="http://localhost/mcp",
376376
http_client=http_client,
377377
) as (read_stream, write_stream):

0 commit comments

Comments
 (0)