(request: pytest.FixtureRequest, resumable: bool)
| 103 | @pytest.mark.asyncio |
| 104 | @pytest.mark.parametrize('resumable', [True, False]) |
| 105 | async def test_run_async(request: pytest.FixtureRequest, resumable: bool): |
| 106 | agent = _TestingAgent(name=f'{request.function.__name__}_test_agent') |
| 107 | loop_agent = LoopAgent( |
| 108 | name=f'{request.function.__name__}_test_loop_agent', |
| 109 | max_iterations=2, |
| 110 | sub_agents=[ |
| 111 | agent, |
| 112 | ], |
| 113 | ) |
| 114 | parent_ctx = await _create_parent_invocation_context( |
| 115 | request.function.__name__, loop_agent, resumable=resumable |
| 116 | ) |
| 117 | events = [e async for e in loop_agent.run_async(parent_ctx)] |
| 118 | |
| 119 | simplified_events = testing_utils.simplify_resumable_app_events(events) |
| 120 | if resumable: |
| 121 | expected_events = [ |
| 122 | ( |
| 123 | loop_agent.name, |
| 124 | {'current_sub_agent': agent.name, 'times_looped': 0}, |
| 125 | ), |
| 126 | (agent.name, f'Hello, async {agent.name}!'), |
| 127 | ( |
| 128 | loop_agent.name, |
| 129 | {'current_sub_agent': agent.name, 'times_looped': 1}, |
| 130 | ), |
| 131 | (agent.name, f'Hello, async {agent.name}!'), |
| 132 | (loop_agent.name, END_OF_AGENT), |
| 133 | ] |
| 134 | else: |
| 135 | expected_events = [ |
| 136 | (agent.name, f'Hello, async {agent.name}!'), |
| 137 | (agent.name, f'Hello, async {agent.name}!'), |
| 138 | ] |
| 139 | assert simplified_events == expected_events |
| 140 | |
| 141 | |
| 142 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected