Fix for #574 @rm-openai I'm not sure how to add a test within the repo but I have pasted a test script below that seems to work ```python import asyncio from openai.types.responses import ResponseTextDeltaEvent from agents import Agent, Runner async def main(): agent = Agent( name="Joker", instructions="You are a helpful assistant.", ) result = Runner.run_streamed(agent, input="Please tell me 5 jokes.") num_visible_event = 0 async for event in result.stream_events(): if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent): print(event.data.delta, end="", flush=True) num_visible_event += 1 print(num_visible_event) if num_visible_event == 3: result.cancel() if __name__ == "__main__": asyncio.run(main()) ```` |
||
|---|---|---|
| .. | ||
| fastapi | ||
| mcp | ||
| models | ||
| tracing | ||
| voice | ||
| __init__.py | ||
| conftest.py | ||
| fake_model.py | ||
| README.md | ||
| test_agent_config.py | ||
| test_agent_hooks.py | ||
| test_agent_runner.py | ||
| test_agent_runner_streamed.py | ||
| test_agent_tracing.py | ||
| test_cancel_streaming.py | ||
| test_computer_action.py | ||
| test_config.py | ||
| test_doc_parsing.py | ||
| test_extension_filters.py | ||
| test_extra_headers.py | ||
| test_function_schema.py | ||
| test_function_tool.py | ||
| test_function_tool_decorator.py | ||
| test_global_hooks.py | ||
| test_guardrails.py | ||
| test_handoff_tool.py | ||
| test_items_helpers.py | ||
| test_max_turns.py | ||
| test_openai_chatcompletions.py | ||
| test_openai_chatcompletions_converter.py | ||
| test_openai_chatcompletions_stream.py | ||
| test_openai_responses_converter.py | ||
| test_output_tool.py | ||
| test_pretty_print.py | ||
| test_responses.py | ||
| test_responses_tracing.py | ||
| test_result_cast.py | ||
| test_run_config.py | ||
| test_run_step_execution.py | ||
| test_run_step_processing.py | ||
| test_strict_schema.py | ||
| test_tool_choice_reset.py | ||
| test_tool_converter.py | ||
| test_tool_use_behavior.py | ||
| test_trace_processor.py | ||
| test_tracing.py | ||
| test_tracing_errors.py | ||
| test_tracing_errors_streamed.py | ||
| test_visualization.py | ||
| testing_processor.py | ||
Tests
Before running any tests, make sure you have uv installed (and ideally run make sync after).
Running tests
make tests
Snapshots
We use inline-snapshots for some tests. If your code adds new snapshot tests or breaks existing ones, you can fix/create them. After fixing/creating snapshots, run make tests again to verify the tests pass.
Fixing snapshots
make snapshots-fix
Creating snapshots
make snapshots-update