Skip to content

Commit 2a30761

Browse files
committed
test: use assertions instead of conditional guards in resumption test
The session ID and protocol version are always set after initialization, so assert their presence rather than silently skipping the headers.
1 parent 55cf282 commit 2a30761

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/shared/test_streamable_http.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ async def run_tool():
13121312

13131313
# Now resume the session with the same mcp-session-id and protocol version
13141314
headers: dict[str, Any] = {}
1315-
if captured_session_id:
1316-
headers[MCP_SESSION_ID_HEADER] = captured_session_id
1317-
if captured_protocol_version:
1318-
headers[MCP_PROTOCOL_VERSION_HEADER] = captured_protocol_version
1315+
assert captured_session_id is not None
1316+
headers[MCP_SESSION_ID_HEADER] = captured_session_id
1317+
assert captured_protocol_version is not None
1318+
headers[MCP_PROTOCOL_VERSION_HEADER] = captured_protocol_version
13191319

13201320
async with create_mcp_http_client(headers=headers) as httpx_client:
13211321
async with streamable_http_client(f"{server_url}/mcp", http_client=httpx_client) as (

0 commit comments

Comments
 (0)