Commit
·
06b4d45
1
Parent(s):
83ee934
fix(tests): Address CodeRabbit review - use TestModel and add marker
Browse files- Add
@pytest
.mark.integration marker per coding guidelines
- Use pydantic_ai.models.test.TestModel instead of string "test"
for proper deterministic, schema-driven test responses
tests/integration/graph/test_workflow.py
CHANGED
|
@@ -1,16 +1,18 @@
|
|
| 1 |
"""Integration tests for the research graph."""
|
| 2 |
|
| 3 |
import pytest
|
|
|
|
| 4 |
|
| 5 |
from src.agents.graph.workflow import create_research_graph
|
| 6 |
|
| 7 |
|
|
|
|
| 8 |
@pytest.mark.asyncio
|
| 9 |
async def test_graph_execution_flow(mocker):
|
| 10 |
"""Test the graph runs from start to finish (simulated)."""
|
| 11 |
-
# Mock get_model to return
|
| 12 |
-
#
|
| 13 |
-
mocker.patch("src.agents.graph.nodes.get_model", return_value=
|
| 14 |
|
| 15 |
# Mock Agent.run to avoid API calls
|
| 16 |
mock_run = mocker.patch("pydantic_ai.Agent.run")
|
|
|
|
| 1 |
"""Integration tests for the research graph."""
|
| 2 |
|
| 3 |
import pytest
|
| 4 |
+
from pydantic_ai.models.test import TestModel
|
| 5 |
|
| 6 |
from src.agents.graph.workflow import create_research_graph
|
| 7 |
|
| 8 |
|
| 9 |
+
@pytest.mark.integration
|
| 10 |
@pytest.mark.asyncio
|
| 11 |
async def test_graph_execution_flow(mocker):
|
| 12 |
"""Test the graph runs from start to finish (simulated)."""
|
| 13 |
+
# Mock get_model to return TestModel for deterministic testing
|
| 14 |
+
# TestModel provides schema-driven responses without hitting real APIs
|
| 15 |
+
mocker.patch("src.agents.graph.nodes.get_model", return_value=TestModel())
|
| 16 |
|
| 17 |
# Mock Agent.run to avoid API calls
|
| 18 |
mock_run = mocker.patch("pydantic_ai.Agent.run")
|