File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
pydantic_ai_slim/pydantic_ai/agent Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -684,6 +684,9 @@ def main():
684684 Returns:
685685 The result of the run.
686686 """
687+ if infer_name and self .name is None :
688+ if frame := inspect .currentframe (): # pragma: no branch
689+ self ._infer_name (frame )
687690
688691 async def _consume_stream ():
689692 async with self .run_stream (
Original file line number Diff line number Diff line change @@ -135,13 +135,7 @@ async def ret_a(x: str) -> str:
135135 )
136136
137137
138- @pytest .fixture
139- def close_cached_httpx_client ():
140- """Override the global fixture to avoid async context issues in sync tests."""
141- yield
142-
143-
144- def test_streamed_text_sync_response (close_cached_httpx_client ): # type: ignore[reportUnknownParameterType]
138+ def test_streamed_text_sync_response ():
145139 m = TestModel ()
146140
147141 test_agent = Agent (m )
@@ -152,7 +146,7 @@ async def ret_a(x: str) -> str:
152146 return f'{ x } -apple'
153147
154148 result = test_agent .run_stream_sync ('Hello' )
155- # assert test_agent.name == 'test_agent'
149+ assert test_agent .name == 'test_agent'
156150 assert not result .is_complete
157151 assert result .all_messages () == snapshot (
158152 [
You can’t perform that action at this time.
0 commit comments