Skip to content

Commit c7522f2

Browse files
committed
Drop the Python no-deref unit test
The conformance scenario already proves no-fetch end to end with a real canary HTTP server; the unit test was a redundant local mirror.
1 parent 2c47fc4 commit c7522f2

1 file changed

Lines changed: 0 additions & 43 deletions

File tree

tests/client/test_output_schema_validation.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import socket
32
from typing import Any
43

54
import pytest
@@ -164,45 +163,3 @@ async def on_call_tool(ctx: ServerRequestContext, params: CallToolRequestParams)
164163
assert result.is_error is False
165164

166165
assert "Tool mystery_tool not listed" in caplog.text
167-
168-
169-
@pytest.mark.anyio
170-
async def test_client_does_not_dereference_network_ref(monkeypatch: pytest.MonkeyPatch):
171-
"""SEP-2106: validating a result must not fetch a network `$ref` in the output schema.
172-
173-
The output schema references a network URI under a property the structured content
174-
never sets. A socket guard fails the test if the client opens any connection while
175-
validating, proving the ref is never dereferenced.
176-
"""
177-
178-
def no_network(*args: object, **kwargs: object) -> None:
179-
raise AssertionError("client attempted a network connection while validating a tool result") # pragma: no cover
180-
181-
monkeypatch.setattr(socket.socket, "connect", no_network)
182-
monkeypatch.setattr(socket, "create_connection", no_network)
183-
184-
output_schema = {
185-
"type": "object",
186-
"properties": {
187-
"ok": {"type": "boolean"},
188-
"profile": {"$ref": "https://canary.invalid/profile-schema.json"},
189-
},
190-
"required": ["ok"],
191-
}
192-
193-
server = _make_server(
194-
tools=[
195-
Tool(
196-
name="lookup",
197-
description="Look something up",
198-
input_schema={"type": "object"},
199-
output_schema=output_schema,
200-
)
201-
],
202-
structured_content={"ok": True},
203-
)
204-
205-
async with Client(server) as client:
206-
result = await client.call_tool("lookup", {})
207-
assert result.is_error is False
208-
assert result.structured_content == {"ok": True}

0 commit comments

Comments
 (0)