Skip to content

Commit 9f7125e

Browse files
committed
fix: remove obsolete test_run_method and fix Pydantic deprecation warning
Signed-off-by: Roberto Rodriguez <[email protected]>
1 parent 076c7d6 commit 9f7125e

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

dapr_agents/types/message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ class LLMChatCandidate(BaseModel):
279279
message: AssistantMessage
280280
finish_reason: Optional[str] = None
281281

282-
class Config:
283-
extra = "allow"
282+
model_config = ConfigDict(extra="allow")
284283

285284

286285
class LLMChatResponse(BaseModel):

tests/agents/durableagent/test_durable_agent.py

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,7 @@ def test_durable_agent_metadata(self, basic_durable_agent):
263263
assert metadata["pubsub_name"] == "testpubsub"
264264
assert metadata["orchestrator"] is False
265265

266-
@pytest.fixture
267-
def mock_wf_client(self):
268-
client = Mock()
269-
client.wait_for_workflow_completion.return_value.serialized_output = {
270-
"output": "test"
271-
}
272-
return client
273-
274-
@pytest.mark.skip(reason="DurableAgent doesn't have a run() method - uses workflow invocation")
275-
@pytest.mark.asyncio
276-
async def test_run_method(self, basic_durable_agent, mock_wf_client):
277-
"""Test the run method returns the workflow result from the injected mock client."""
278-
basic_durable_agent.wf_client = mock_wf_client
279-
result = await basic_durable_agent.run("test input")
280-
assert result == {"output": "test"}
281-
282-
@pytest.mark.asyncio
283-
async def test_tool_calling_workflow_initialization(
266+
def test_tool_calling_workflow_initialization(
284267
self, basic_durable_agent, mock_workflow_context
285268
):
286269
"""Test workflow initialization on first iteration."""
@@ -297,32 +280,33 @@ async def test_tool_calling_workflow_initialization(
297280
"stop",
298281
]
299282

300-
basic_durable_agent.state["instances"]["test-instance-123"] = {
301-
"input": "Test task",
302-
"source": None,
303-
"triggering_workflow_instance_id": "parent-instance-123",
304-
"workflow_instance_id": "test-instance-123",
305-
"workflow_name": "AgenticWorkflow",
306-
"status": "RUNNING",
307-
"messages": [],
308-
"tool_history": [],
309-
"end_time": None,
310-
"trace_context": None,
311-
}
283+
# Use AgentWorkflowEntry for state setup
284+
entry = AgentWorkflowEntry(
285+
input_value="Test task",
286+
source=None,
287+
triggering_workflow_instance_id="parent-instance-123",
288+
workflow_instance_id="test-instance-123",
289+
workflow_name="AgenticWorkflow",
290+
status="RUNNING",
291+
messages=[],
292+
tool_history=[],
293+
)
294+
basic_durable_agent._state_model.instances["test-instance-123"] = entry
312295

313296
workflow_gen = basic_durable_agent.agent_workflow(
314297
mock_workflow_context, message
315298
)
316299
try:
317-
await workflow_gen.__anext__()
318-
except StopAsyncIteration:
300+
next(workflow_gen) # agent_workflow is a generator, not async
301+
except StopIteration:
319302
pass
320303

321304
assert "test-instance-123" in basic_durable_agent.state["instances"]
322-
instance_data = basic_durable_agent.state["instances"]["test-instance-123"]
323-
assert instance_data["input"] == "Test task"
324-
assert instance_data["source"] is None
325-
assert instance_data["triggering_workflow_instance_id"] == "parent-instance-123"
305+
instance_data = basic_durable_agent._state_model.instances["test-instance-123"]
306+
# Instance data is an AgentWorkflowEntry object
307+
assert instance_data.input_value == "Test task"
308+
assert instance_data.source is None
309+
assert instance_data.triggering_workflow_instance_id == "parent-instance-123"
326310

327311
@pytest.mark.asyncio
328312
async def test_call_llm_activity(self, basic_durable_agent):
@@ -957,6 +941,7 @@ def test_construct_messages_with_instance_history(self, basic_durable_agent):
957941
assert len(user_messages) >= 1
958942
assert len(assistant_messages) >= 1
959943

944+
@pytest.mark.skip(reason="broadcast_message method removed - functionality moved to workflow activities")
960945
@pytest.mark.asyncio
961946
async def test_broadcast_message(self, basic_durable_agent):
962947
"""Test broadcasting message."""
@@ -970,6 +955,7 @@ async def test_broadcast_message(self, basic_durable_agent):
970955
# This needs refactoring / better implementation on this test since the actual implementation would depend on the pubsub msg broker.
971956
await basic_durable_agent.broadcast_message(broadcast_msg)
972957

958+
@pytest.mark.skip(reason="send_message_to_agent method removed - functionality moved to workflow activities")
973959
@pytest.mark.asyncio
974960
async def test_send_message_to_agent(self, basic_durable_agent):
975961
"""Test sending message to specific agent."""
@@ -986,9 +972,13 @@ async def test_send_message_to_agent(self, basic_durable_agent):
986972

987973
def test_register_agentic_system(self, basic_durable_agent):
988974
"""Test registering agentic system."""
989-
# TODO(@Sicoyle): fix this to add assertions.
990-
basic_durable_agent.register_agentic_system()
975+
# Mock registry_state.save to prevent actual state store operations
976+
with patch.object(basic_durable_agent.registry_state, "save"):
977+
basic_durable_agent.register_agentic_system()
978+
# Verify it completes without error
979+
assert True # If we get here, registration succeeded
991980

981+
@pytest.mark.skip(reason="process_broadcast_message method removed - functionality moved to workflow activities")
992982
@pytest.mark.asyncio
993983
async def test_process_broadcast_message(self, basic_durable_agent):
994984
"""Test processing broadcast message."""
@@ -1008,6 +998,7 @@ def test_durable_agent_properties(self, basic_durable_agent):
1008998
assert basic_durable_agent.text_formatter is not None
1009999
assert basic_durable_agent.state is not None
10101000

1001+
@pytest.mark.skip(reason="_workflow_name attribute removed in refactoring")
10111002
def test_durable_agent_workflow_name(self, basic_durable_agent):
10121003
"""Test that the workflow name is set correctly."""
10131004
assert basic_durable_agent._workflow_name == "AgenticWorkflow"

0 commit comments

Comments
 (0)