File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1878,13 +1878,13 @@ async def parent_function():
18781878
18791879
18801880@pytest .mark .asyncio
1881- async def test_async_generator_exception_handling_with_context ():
1882- """Test that exceptions in async generators are properly handled while preserving context"""
1881+ async def test_sync_generator_exception_handling_with_context ():
1882+ """Test that exceptions in sync generators are properly handled while preserving context"""
18831883 langfuse = get_client ()
18841884 mock_trace_id = langfuse .create_trace_id ()
18851885
18861886 @observe (name = "failing_generator" )
1887- async def failing_generator ():
1887+ def failing_generator ():
18881888 current_span = trace .get_current_span ()
18891889 # Verify we have valid context even when exception occurs
18901890 assert (
@@ -1893,7 +1893,6 @@ async def failing_generator():
18931893 )
18941894
18951895 yield "first_item"
1896- await asyncio .sleep (0.001 )
18971896 raise ValueError ("Generator failure test" )
18981897 yield "never_reached" # This should never execute
18991898
@@ -1906,7 +1905,7 @@ async def root_function():
19061905
19071906 items = []
19081907 with pytest .raises (ValueError , match = "Generator failure test" ):
1909- async for item in generator :
1908+ for item in generator :
19101909 items .append (item )
19111910
19121911 langfuse .flush ()
You can’t perform that action at this time.
0 commit comments