Skip to content

Commit c72ae6b

Browse files
committed
fix: add coverage pragmas for version-dependent resumption test lines
Lines 1307-1309 (post-cancel assertions) are not reached on Python 3.14 due to cancel scope behavior. The ClientSession async with on line 1327 has an untaken exit branch. Mark accordingly with lax no cover and no branch pragmas.
1 parent ae6943c commit c72ae6b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/shared/test_streamable_http.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,9 @@ async def run_tool():
13041304

13051305
# Verify we received exactly one notification (inside ClientSession
13061306
# so coverage tracks these on Python 3.11, see PR #1897 for details)
1307-
assert len(captured_notifications) == 1
1308-
assert isinstance(captured_notifications[0], types.LoggingMessageNotification)
1309-
assert captured_notifications[0].params.data == "First notification before lock"
1307+
assert len(captured_notifications) == 1 # pragma: lax no cover
1308+
assert isinstance(captured_notifications[0], types.LoggingMessageNotification) # pragma: lax no cover
1309+
assert captured_notifications[0].params.data == "First notification before lock" # pragma: lax no cover
13101310

13111311
# Clear notifications and set up headers for phase 2 (between connections,
13121312
# not tracked by coverage on Python 3.11 due to cancel scope + sys.settrace bug)
@@ -1324,7 +1324,9 @@ async def run_tool():
13241324
write_stream,
13251325
_,
13261326
):
1327-
async with ClientSession(read_stream, write_stream, message_handler=message_handler) as session:
1327+
async with ClientSession(
1328+
read_stream, write_stream, message_handler=message_handler
1329+
) as session: # pragma: no branch
13281330
result = await session.send_request(
13291331
types.CallToolRequest(params=types.CallToolRequestParams(name="release_lock", arguments={})),
13301332
types.CallToolResult,

0 commit comments

Comments
 (0)