Skip to content

test(pydantic-ai): Fix assertion for missing tool description

a0bd0dc
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feat(pydantic-ai): Add tool description to execute_tool spans #5596

test(pydantic-ai): Fix assertion for missing tool description
a0bd0dc
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden completed Mar 6, 2026 in 3m 1s

2 issues

Medium

Test asserts tool description is present when PR description says it should be omitted - `tests/integrations/pydantic_ai/test_pydantic_ai.py:2869-2871`

The test test_tool_without_description_omits_tool_description asserts that SPANDATA.GEN_AI_TOOL_DESCRIPTION in tool_span['data'] is True and its value is None. However, the PR description explicitly states: 'If no description is available (e.g. the tool has no docstring), the attribute is omitted from the span entirely.' The test docstring also says 'omits tool description' but the assertions verify the opposite - that it IS present with a None value.

Test asserts tool description is present but None, contradicting PR's stated omission behavior - `tests/integrations/pydantic_ai/test_pydantic_ai.py:2871-2872`

The test test_tool_without_description_omits_tool_description (line 2871-2872) asserts that when a tool has no docstring, SPANDATA.GEN_AI_TOOL_DESCRIPTION should be present in the span data with value None. However, the PR description explicitly states: 'If no description is available (e.g. the tool has no docstring), the attribute is omitted from the span entirely.' The implementation in execute_tool.py line 41-42 only checks if tool_definition: before setting the description, so it will set None when the tool exists but has no docstring. The test should either assert the attribute is NOT present (matching PR intent), or the implementation needs to check if tool_definition and tool_definition.description:.

Also found at:

  • sentry_sdk/integrations/pydantic_ai/spans/execute_tool.py:41-42
4 skills analyzed
Skill Findings Duration Cost
code-review 1 1m 7s $0.92
find-bugs 1 2m 55s $1.11
skill-scanner 0 50.5s $0.31
security-review 0 1m 12s $0.37

Duration: 6m 5s · Tokens: 1.6M in / 22.8k out · Cost: $2.72 (+extraction: $0.01, +merge: $0.00, +dedup: $0.00)