@@ -146,7 +146,6 @@ async def test_agent_run_async(
146146 # The transaction itself should have invoke_agent data
147147 assert transaction ["contexts" ]["trace" ]["op" ] == "gen_ai.invoke_agent"
148148
149- sentry_sdk .flush ()
150149 spans = [item .payload for item in items if item .type == "span" ]
151150 # Find child span types (invoke_agent is the transaction, not a child span)
152151 chat_spans = [
@@ -258,7 +257,6 @@ def failing_model(messages, info):
258257 (error ,) = (item .payload for item in items if item .type == "event" )
259258 assert error ["level" ] == "error"
260259
261- sentry_sdk .flush ()
262260 spans = [item .payload for item in items if item .type == "span" ]
263261 assert len (spans ) == 1
264262
@@ -347,7 +345,6 @@ def test_agent_run_sync(
347345 assert transaction ["contexts" ]["trace" ]["origin" ] == "auto.ai.pydantic_ai"
348346
349347 # Find span types
350- sentry_sdk .flush ()
351348 spans = [item .payload for item in items if item .type == "span" ]
352349 chat_spans = [
353350 s for s in spans if s ["attributes" ].get ("sentry.op" , "" ) == "gen_ai.chat"
@@ -428,7 +425,6 @@ def failing_model(messages, info):
428425 (error ,) = (item .payload for item in items if item .type == "event" )
429426 assert error ["level" ] == "error"
430427
431- sentry_sdk .flush ()
432428 spans = [item .payload for item in items if item .type == "span" ]
433429 assert len (spans ) == 1
434430
@@ -537,7 +533,6 @@ async def test_agent_run_stream(
537533 assert transaction ["contexts" ]["trace" ]["origin" ] == "auto.ai.pydantic_ai"
538534
539535 # Find chat spans
540- sentry_sdk .flush ()
541536 spans = [item .payload for item in items if item .type == "span" ]
542537 chat_spans = [
543538 s for s in spans if s ["attributes" ].get ("sentry.op" , "" ) == "gen_ai.chat"
@@ -676,7 +671,6 @@ async def test_agent_run_stream_events(
676671 assert transaction ["transaction" ] == "invoke_agent test_agent"
677672
678673 # Find chat spans
679- sentry_sdk .flush ()
680674 spans = [item .payload for item in items if item .type == "span" ]
681675 chat_spans = [
682676 s for s in spans if s ["attributes" ].get ("sentry.op" , "" ) == "gen_ai.chat"
0 commit comments