Skip to content

Commit ffccfd3

Browse files
committed
test: cover session start/exit in cleanup test
1 parent 9de7f7b commit ffccfd3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/client/test_resource_cleanup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ async def mock_send(*args: Any, **kwargs: Any):
5050
initial_stream_count = len(session._response_streams)
5151

5252
# Run the test with the patched method
53-
with patch.object(session._write_stream, "send", mock_send):
54-
with pytest.raises(RuntimeError):
55-
await session.send_request(request, EmptyResult)
53+
async with session:
54+
with patch.object(session._write_stream, "send", mock_send):
55+
with pytest.raises(RuntimeError, match="Simulated network error"):
56+
await session.send_request(request, EmptyResult)
5657

5758
# Verify that no response streams were leaked
5859
assert len(session._response_streams) == initial_stream_count, (

0 commit comments

Comments
 (0)