Skip to content

Commit bd072e2

Browse files
merge master
2 parents 13db5b4 + 48c48d2 commit bd072e2

1 file changed

Lines changed: 0 additions & 83 deletions

File tree

‎tests/integrations/pydantic_ai/test_pydantic_ai.py‎

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,89 +2319,6 @@ async def test_should_send_prompts_without_pii(
23192319
assert _should_send_outputs() is False
23202320

23212321

2322-
@pytest.mark.asyncio
2323-
async def test_set_agent_data_without_agent(
2324-
sentry_init,
2325-
):
2326-
"""
2327-
Test that _set_agent_data handles None agent gracefully.
2328-
"""
2329-
import sentry_sdk
2330-
from sentry_sdk.integrations.pydantic_ai.utils import _set_agent_data
2331-
2332-
sentry_init(
2333-
integrations=[PydanticAIIntegration()],
2334-
traces_sample_rate=1.0,
2335-
)
2336-
2337-
span = sentry_sdk.traces.start_span(name="test_span")
2338-
2339-
# Pass None agent, with no agent in scope
2340-
_set_agent_data(span, None)
2341-
2342-
span.end()
2343-
2344-
2345-
@pytest.mark.asyncio
2346-
async def test_set_agent_data_from_scope(
2347-
sentry_init,
2348-
):
2349-
"""
2350-
Test that _set_agent_data retrieves agent from scope when not passed.
2351-
"""
2352-
from unittest.mock import MagicMock
2353-
2354-
import sentry_sdk
2355-
from sentry_sdk.integrations.pydantic_ai.utils import _set_agent_data
2356-
2357-
sentry_init(
2358-
integrations=[PydanticAIIntegration()],
2359-
traces_sample_rate=1.0,
2360-
)
2361-
2362-
# Set agent in scope
2363-
scope = sentry_sdk.get_current_scope()
2364-
mock_agent = MagicMock()
2365-
mock_agent.name = "test_agent_from_scope"
2366-
scope._contexts["pydantic_ai_agent"] = {"_agent": mock_agent}
2367-
2368-
span = sentry_sdk.traces.start_span(name="test_span")
2369-
2370-
# Pass None for agent, should get from scope
2371-
_set_agent_data(span, None)
2372-
2373-
span.end()
2374-
2375-
2376-
@pytest.mark.asyncio
2377-
async def test_set_agent_data_without_name(
2378-
sentry_init,
2379-
):
2380-
"""
2381-
Test that _set_agent_data handles agent without name attribute.
2382-
"""
2383-
from unittest.mock import MagicMock
2384-
2385-
import sentry_sdk
2386-
from sentry_sdk.integrations.pydantic_ai.utils import _set_agent_data
2387-
2388-
sentry_init(
2389-
integrations=[PydanticAIIntegration()],
2390-
traces_sample_rate=1.0,
2391-
)
2392-
2393-
span = sentry_sdk.traces.start_span(name="test_span")
2394-
2395-
# Create agent without name
2396-
mock_agent = MagicMock()
2397-
mock_agent.name = None # No name
2398-
2399-
# Should not set agent name
2400-
_set_agent_data(span, mock_agent)
2401-
2402-
span.end()
2403-
2404-
24052322
@pytest.mark.asyncio
24062323
async def test_set_available_tools_without_toolset(
24072324
sentry_init,

0 commit comments

Comments
 (0)