fix(pydantic-ai): Use first-class hooks when available #5947
2 issues
code-review: Found 2 issues (1 medium, 1 low)
Medium
test_agent_run_sync_model_error uses async method instead of synchronous run_sync - `tests/integrations/pydantic_ai/test_pydantic_ai.py:207-225`
The test test_agent_run_sync_model_error is marked with @pytest.mark.asyncio and uses await agent.run(), but the name implies it should test synchronous behavior with agent.run_sync(). This test does not actually verify synchronous error handling—it duplicates test_agent_run_async_model_error. Users relying on run_sync() error behavior won't have test coverage.
Low
Debug print statement left in test code - `tests/integrations/pydantic_ai/test_pydantic_ai.py:227`
A debug print("events", len(events)) statement at line 227 was left in the test code. While this won't cause test failures, it clutters test output and indicates the code wasn't cleaned up before submission.
Duration: 5m 20s · Tokens: 1.1M in / 16.2k out · Cost: $1.85 (+extraction: $0.00, +merge: $0.00)
Annotations
Check warning on line 225 in tests/integrations/pydantic_ai/test_pydantic_ai.py
sentry-warden / warden: code-review
test_agent_run_sync_model_error uses async method instead of synchronous run_sync
The test `test_agent_run_sync_model_error` is marked with `@pytest.mark.asyncio` and uses `await agent.run()`, but the name implies it should test synchronous behavior with `agent.run_sync()`. This test does not actually verify synchronous error handling—it duplicates `test_agent_run_async_model_error`. Users relying on `run_sync()` error behavior won't have test coverage.