Skip to content

Commit 8cfdd44

Browse files
committed
Restructure list_roots deprecation test to cover its branches on 3.14
The `with anyio.fail_after(...)` block was the last statement in the test and nested inside `pytest.warns`, so coverage.py flagged its `->exit` arc as a partial branch on 3.14. Move `fail_after` to the outer `with` and add a trailing assertion (the call reached the wire), matching the sibling `list_roots` tests.
1 parent a465678 commit 8cfdd44

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/shared/test_peer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ async def test_peer_list_roots_is_deprecated_sep_2577():
150150
rec = _Recorder({"roots": []})
151151
async with running_pair(direct_pair, server_on_request=rec.on_request) as (client, *_):
152152
peer = ClientPeer(client)
153-
with pytest.warns(MCPDeprecationWarning, match=r"`list_roots` is deprecated as of 2026-07-28 \(SEP-2577\)\."):
154-
with anyio.fail_after(5):
153+
with anyio.fail_after(5):
154+
with pytest.warns(
155+
MCPDeprecationWarning, match=r"`list_roots` is deprecated as of 2026-07-28 \(SEP-2577\)\."
156+
):
155157
await peer.list_roots() # pyright: ignore[reportDeprecated]
158+
assert rec.seen[0][0] == "roots/list"
156159

157160

158161
def test_dump_params_merges_meta_over_model_meta():

0 commit comments

Comments
 (0)