chore: apply suggestion
Changed `add_background_task` to `add_behavior` and added extra docs.
This commit is contained in:
@@ -42,7 +42,7 @@ async def test_normal_setup(per_transcription_agent):
|
||||
async def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_background_task = swallow_background_task
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
per_vad_agent.reset_stream = AsyncMock()
|
||||
|
||||
await per_vad_agent.setup()
|
||||
@@ -110,7 +110,7 @@ async def test_out_socket_creation_failure(zmq_context):
|
||||
async def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_background_task = swallow_background_task
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
|
||||
await per_vad_agent.setup()
|
||||
|
||||
@@ -130,7 +130,7 @@ async def test_stop(zmq_context, per_transcription_agent):
|
||||
async def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_background_task = swallow_background_task
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
zmq_context.return_value.socket.return_value.bind_to_random_port.return_value = random.randint(
|
||||
1000,
|
||||
10000,
|
||||
|
||||
@@ -35,7 +35,7 @@ async def test_setup_bind(zmq_context, mocker):
|
||||
coro.close()
|
||||
|
||||
swallow = Swallow()
|
||||
agent.add_background_task = swallow
|
||||
agent.add_behavior = swallow
|
||||
|
||||
await agent.setup()
|
||||
|
||||
@@ -62,7 +62,7 @@ async def test_setup_connect(zmq_context, mocker):
|
||||
coro.close()
|
||||
|
||||
swallow = Swallow()
|
||||
agent.add_background_task = swallow
|
||||
agent.add_behavior = swallow
|
||||
|
||||
await agent.setup()
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ async def test_setup_success_connects_and_starts_robot(zmq_context):
|
||||
coro.close()
|
||||
|
||||
swallow = Swallow()
|
||||
agent.add_background_task = swallow
|
||||
agent.add_behavior = swallow
|
||||
|
||||
await agent.setup()
|
||||
|
||||
@@ -85,7 +85,7 @@ async def test_setup_binds_when_requested(zmq_context):
|
||||
coro.close()
|
||||
|
||||
swallow = Swallow()
|
||||
agent.add_background_task = swallow
|
||||
agent.add_behavior = swallow
|
||||
|
||||
with patch(speech_agent_path(), autospec=True) as MockRobot:
|
||||
MockRobot.return_value.start = AsyncMock()
|
||||
@@ -213,7 +213,7 @@ async def test_setup_warns_on_failed_negotiate(zmq_context, mocker):
|
||||
async def swallow(coro):
|
||||
coro.close()
|
||||
|
||||
agent.add_background_task = swallow
|
||||
agent.add_behavior = swallow
|
||||
agent._negotiate_connection = AsyncMock(return_value=False)
|
||||
|
||||
await agent.setup()
|
||||
|
||||
@@ -36,7 +36,7 @@ async def test_transcription_agent_flow(mock_zmq_context):
|
||||
agent.send = AsyncMock()
|
||||
|
||||
agent._running = True
|
||||
agent.add_background_task = AsyncMock()
|
||||
agent.add_behavior = AsyncMock()
|
||||
|
||||
await agent.setup()
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ async def test_agent_lifecycle():
|
||||
async def dummy_task():
|
||||
await asyncio.sleep(0.01)
|
||||
|
||||
await agent.add_background_task(dummy_task())
|
||||
await agent.add_behavior(dummy_task())
|
||||
assert len(agent._tasks) > 0
|
||||
|
||||
# Wait for task to finish
|
||||
|
||||
Reference in New Issue
Block a user