Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Remove redundant MCP schema inspection test (#11506)

Trevor Manz1d7cc31f4fe7
diff --git a/tests/_utils/test_msgspec_basestruct.py b/tests/_utils/test_msgspec_basestruct.py
index e4f7ca8ba7..d342b97753 100644
--- a/tests/_utils/test_msgspec_basestruct.py
+++ b/tests/_utils/test_msgspec_basestruct.py
@@ -1,7 +1,5 @@
import json
-import typing as t
-import msgspec
import pytest
from pydantic import TypeAdapter, ValidationError
@@ -60,53 +58,6 @@ TOOL_IO_CLASSES = [
]
-def _iter_types(ann: t.Any):
- stack = [ann]
- seen: set[int] = set()
- while stack:
- tp = stack.pop()
- obj_id = id(tp)
- if obj_id in seen:
- continue
- seen.add(obj_id)
-
- if isinstance(tp, type):
- yield tp
- # Recurse into dataclass-like classes by following their annotations
- anns = getattr(tp, "__annotations__", None)
- if anns:
- stack.extend(anns.values())
- continue
-
- origin = t.get_origin(tp)
- if origin is not None:
- stack.append(origin)
- stack.extend(t.get_args(tp))
-
-
-def test_tool_msgspec_structs_expose_pydantic_hook() -> None:
- offenders: list[str] = []
- for cls in TOOL_IO_CLASSES:
- for ann in (getattr(cls, "__annotations__", {}) or {}).values():
- for resolved_type in _iter_types(ann):
- if isinstance(resolved_type, type) and issubclass(
- resolved_type, msgspec.Struct
- ):
- if not callable(
- getattr(
- resolved_type, "__get_pydantic_core_schema__", None
- )
- ):
- offenders.append(
- f"{resolved_type.__module__}.{resolved_type.__name__} (referenced by {cls.__module__}.{cls.__name__})"
- )
-
- assert not offenders, (
- "These msgspec.Structs referenced by tools must use BaseStruct as their base class: "
- + ", ".join(offenders)
- )
-
-
@pytest.mark.parametrize("tool_io_class", TOOL_IO_CLASSES)
def test_tool_io_exposes_pydantic_schema(tool_io_class: type) -> None:
TypeAdapter(tool_io_class).json_schema()