Support Python 3.14 (#1834)
This commit is contained in:
parent
1fd557afdc
commit
3ffe142e9a
6 changed files with 427 additions and 323 deletions
|
|
@ -312,7 +312,8 @@ async def test_task_metadata_in_call_tool_request() -> None:
|
|||
async with anyio.create_task_group() as tg:
|
||||
|
||||
async def handle_messages():
|
||||
async for message in server_session.incoming_messages:
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
async for message in server_session.incoming_messages: # pragma: no cover
|
||||
await server._handle_message(message, server_session, {}, False)
|
||||
|
||||
tg.start_soon(handle_messages)
|
||||
|
|
@ -391,8 +392,8 @@ async def test_task_metadata_is_task_property() -> None:
|
|||
),
|
||||
) as server_session:
|
||||
async with anyio.create_task_group() as tg:
|
||||
|
||||
async def handle_messages():
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
async def handle_messages(): # pragma: no cover
|
||||
async for message in server_session.incoming_messages:
|
||||
await server._handle_message(message, server_session, {}, False)
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ async def run_tool_test(
|
|||
async with anyio.create_task_group() as tg:
|
||||
|
||||
async def handle_messages():
|
||||
async for message in server_session.incoming_messages:
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
async for message in server_session.incoming_messages: # pragma: no cover
|
||||
await server._handle_message(message, server_session, {}, False)
|
||||
|
||||
tg.start_soon(handle_messages)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ async def run_tool_test(
|
|||
async with anyio.create_task_group() as tg:
|
||||
|
||||
async def handle_messages():
|
||||
async for message in server_session.incoming_messages:
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
async for message in server_session.incoming_messages: # pragma: no cover
|
||||
await server._handle_message(message, server_session, {}, False)
|
||||
|
||||
tg.start_soon(handle_messages)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ async def test_lowlevel_server_tool_annotations():
|
|||
async with anyio.create_task_group() as tg:
|
||||
|
||||
async def handle_messages():
|
||||
async for message in server_session.incoming_messages:
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
async for message in server_session.incoming_messages: # pragma: no cover
|
||||
await server._handle_message(message, server_session, {}, False)
|
||||
|
||||
tg.start_soon(handle_messages)
|
||||
|
|
|
|||
|
|
@ -410,11 +410,9 @@ async def test_create_message_tool_result_validation():
|
|||
|
||||
# Case 8: empty messages list - skips validation entirely
|
||||
# Covers the `if messages:` branch (line 280->302)
|
||||
with anyio.move_on_after(0.01):
|
||||
await session.create_message(
|
||||
messages=[],
|
||||
max_tokens=100,
|
||||
)
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.move_on_after(0.01): # pragma: no cover
|
||||
await session.create_message(messages=[], max_tokens=100)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ async def test_request_cancellation():
|
|||
)
|
||||
|
||||
# Give cancellation time to process
|
||||
with anyio.fail_after(1):
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.fail_after(1): # pragma: no cover
|
||||
await ev_cancelled.wait()
|
||||
|
||||
|
||||
|
|
@ -176,7 +177,8 @@ async def test_response_id_type_mismatch_string_to_int():
|
|||
tg.start_soon(mock_server)
|
||||
tg.start_soon(make_request, client_session)
|
||||
|
||||
with anyio.fail_after(2):
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.fail_after(2): # pragma: no cover
|
||||
await ev_response_received.wait()
|
||||
|
||||
assert len(result_holder) == 1
|
||||
|
|
@ -232,7 +234,8 @@ async def test_error_response_id_type_mismatch_string_to_int():
|
|||
tg.start_soon(mock_server)
|
||||
tg.start_soon(make_request, client_session)
|
||||
|
||||
with anyio.fail_after(2):
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.fail_after(2): # pragma: no cover
|
||||
await ev_error_received.wait()
|
||||
|
||||
assert len(error_holder) == 1
|
||||
|
|
@ -287,7 +290,8 @@ async def test_response_id_non_numeric_string_no_match():
|
|||
tg.start_soon(mock_server)
|
||||
tg.start_soon(make_request, client_session)
|
||||
|
||||
with anyio.fail_after(2):
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.fail_after(2): # pragma: no cover
|
||||
await ev_timeout.wait()
|
||||
|
||||
|
||||
|
|
@ -333,7 +337,8 @@ async def test_connection_closed():
|
|||
tg.start_soon(make_request, client_session)
|
||||
tg.start_soon(mock_server)
|
||||
|
||||
with anyio.fail_after(1):
|
||||
# TODO(Marcelo): Drop the pragma once https://github.com/coveragepy/coveragepy/issues/1987 is fixed.
|
||||
with anyio.fail_after(1): # pragma: no cover
|
||||
await ev_closed.wait()
|
||||
with anyio.fail_after(1):
|
||||
with anyio.fail_after(1): # pragma: no cover
|
||||
await ev_response.wait()
|
||||
|
|
|
|||
Loading…
Reference in a new issue