fix(tests): Resolve unawaited coroutine warnings in spawn interception tests
This commit is contained in:
@@ -54,13 +54,12 @@ async def test_confirm_spawn_pushed_to_queue() -> None:
|
||||
assert final_context == "Modified Context"
|
||||
|
||||
@patch("multi_agent_conductor.confirm_spawn")
|
||||
def test_run_worker_lifecycle_approved(mock_confirm: MagicMock, mock_ai_client: MagicMock) -> None:
|
||||
def test_run_worker_lifecycle_approved(mock_confirm: MagicMock, mock_ai_client: MagicMock, app_instance) -> None:
|
||||
ticket = Ticket(id="T1", description="desc", status="todo", assigned_to="user")
|
||||
context = WorkerContext(ticket_id="T1", model_name="model", messages=[])
|
||||
event_queue = events.AsyncEventQueue()
|
||||
event_queue = app_instance.event_queue
|
||||
mock_confirm.return_value = (True, "Modified Prompt", "Modified Context")
|
||||
loop = MagicMock()
|
||||
multi_agent_conductor.run_worker_lifecycle(ticket, context, event_queue=event_queue, loop=loop)
|
||||
multi_agent_conductor.run_worker_lifecycle(ticket, context, event_queue=event_queue, loop=app_instance._loop)
|
||||
mock_confirm.assert_called_once()
|
||||
# Check that ai_client.send was called with modified values
|
||||
args, kwargs = mock_ai_client.call_args
|
||||
@@ -69,13 +68,12 @@ def test_run_worker_lifecycle_approved(mock_confirm: MagicMock, mock_ai_client:
|
||||
assert ticket.status == "completed"
|
||||
|
||||
@patch("multi_agent_conductor.confirm_spawn")
|
||||
def test_run_worker_lifecycle_rejected(mock_confirm: MagicMock, mock_ai_client: MagicMock) -> None:
|
||||
def test_run_worker_lifecycle_rejected(mock_confirm: MagicMock, mock_ai_client: MagicMock, app_instance) -> None:
|
||||
ticket = Ticket(id="T1", description="desc", status="todo", assigned_to="user")
|
||||
context = WorkerContext(ticket_id="T1", model_name="model", messages=[])
|
||||
event_queue = events.AsyncEventQueue()
|
||||
event_queue = app_instance.event_queue
|
||||
mock_confirm.return_value = (False, "Original Prompt", "Original Context")
|
||||
loop = MagicMock()
|
||||
result = multi_agent_conductor.run_worker_lifecycle(ticket, context, event_queue=event_queue, loop=loop)
|
||||
result = multi_agent_conductor.run_worker_lifecycle(ticket, context, event_queue=event_queue, loop=app_instance._loop)
|
||||
mock_confirm.assert_called_once()
|
||||
mock_ai_client.assert_not_called()
|
||||
assert ticket.status == "blocked"
|
||||
|
||||
Reference in New Issue
Block a user