Skip to content

Commit d54b9c1

Browse files
Fix ty type errors in integration tests
Lift State TypedDict to module level so ty can see it satisfies StateGraph's type bound. Remove now-stale ignore comments in DMS tests.
1 parent f898534 commit d54b9c1

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

tests/core/integration/telemetry/_agent.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55

66
import pytest
77

8+
try:
9+
from langchain_core.messages import BaseMessage
10+
from langgraph.graph.message import add_messages
11+
12+
class State(TypedDict):
13+
messages: Annotated[list[BaseMessage], add_messages]
14+
15+
except ImportError:
16+
pass
17+
818

919
def build_langgraph_agent():
1020
"""Build a minimal single-node LangGraph agent backed by LiteLLM via AI Core.
@@ -14,19 +24,14 @@ def build_langgraph_agent():
1424
"sap/<model>" prefix to route through the SAP AI Core provider.
1525
"""
1626
try:
17-
from langchain_core.messages import BaseMessage
1827
from langchain_litellm import ChatLiteLLM
1928
from langgraph.graph import END, StateGraph
20-
from langgraph.graph.message import add_messages
2129
except ImportError:
2230
pytest.skip("langchain-litellm or langgraph not installed")
2331

2432
model_name = os.environ.get("AICORE_MODEL") or "anthropic--claude-4.5-sonnet"
2533
llm = ChatLiteLLM(model=f"sap/{model_name}")
2634

27-
class State(TypedDict):
28-
messages: Annotated[list[BaseMessage], add_messages]
29-
3035
def call_llm(state: State) -> State:
3136
return {"messages": [llm.invoke(state["messages"])]}
3237

tests/dms/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def dms_client():
1414
client = create_client(instance="default")
1515
return client
1616
except Exception as e:
17-
pytest.skip(f"DMS integration tests require credentials: {e}") # ty: ignore[invalid-argument-type, too-many-positional-arguments]
17+
pytest.skip(f"DMS integration tests require credentials: {e}")
1818

1919

2020
def _setup_cloud_mode():

tests/dms/integration/test_dms_bdd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def select_version_repo(context: DMSTestContext, dms_client: DMSClient):
128128
version_repo = r
129129
break
130130
if version_repo is None:
131-
pytest.skip("No version-enabled repository available") # ty: ignore[invalid-argument-type, too-many-positional-arguments]
131+
pytest.skip("No version-enabled repository available")
132132
context.repo = version_repo
133133
context.repo_id = version_repo.id
134134

0 commit comments

Comments
 (0)