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.

deflake ai-types test (#7835)

Shahmir Varqha7de6cea6df50
diff --git a/marimo/_dependencies/dependencies.py b/marimo/_dependencies/dependencies.py
index 4102776808..001a365e58 100644
--- a/marimo/_dependencies/dependencies.py
+++ b/marimo/_dependencies/dependencies.py
@@ -239,6 +239,7 @@ class DependencyManager:
redshift_connector = Dependency("redshift_connector")
mcp = Dependency("mcp")
pydantic_ai = Dependency("pydantic_ai")
+ pydantic = Dependency("pydantic")
zmq = Dependency("zmq") # pyzmq for sandbox IPC kernels
# Version requirements to properly support the new superfences introduced in
diff --git a/tests/_ai/test_ai_types.py b/tests/_ai/test_ai_types.py
index 940b3b1982..eb66ef0011 100644
--- a/tests/_ai/test_ai_types.py
+++ b/tests/_ai/test_ai_types.py
@@ -98,6 +98,10 @@ class TestChatMessageCreate:
parts=[existing_part], # type: ignore
)
+ @pytest.mark.skipif(
+ not DependencyManager.pydantic.has(),
+ reason="pydantic is not installed",
+ )
def test_dict_parts_with_dataclass_validator(self):
"""Test converting dict parts using a dataclass validator."""
dict_part: dict[str, str] = {"type": "text", "text": "Hello from dict"}
@@ -117,6 +121,10 @@ class TestChatMessageCreate:
parts=[TextPart(type="text", text="Hello from dict")],
)
+ @pytest.mark.skipif(
+ not DependencyManager.pydantic.has(),
+ reason="pydantic is not installed",
+ )
def test_mixed_parts_with_validator(self):
"""Test with a mix of already-typed and dict parts."""