chore: remove pipeline stuff
This commit is contained in:
@@ -4,8 +4,6 @@ from unittest.mock import ANY, AsyncMock, MagicMock, patch
|
||||
import pytest
|
||||
|
||||
from control_backend.agents.communication.ri_communication_agent import RICommunicationAgent
|
||||
from control_backend.core.agent_system import InternalMessage
|
||||
from control_backend.schemas.ri_message import PauseCommand, RIEndpoint
|
||||
|
||||
|
||||
def speech_agent_path():
|
||||
@@ -396,38 +394,3 @@ async def test_negotiate_req_socket_none_causes_retry(zmq_context):
|
||||
result = await agent._negotiate_connection(max_retries=1)
|
||||
|
||||
assert result is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_handle_message_pause_command(zmq_context):
|
||||
"""Test handle_message with a valid PauseCommand."""
|
||||
agent = RICommunicationAgent("ri_comm")
|
||||
agent._req_socket = AsyncMock()
|
||||
agent.logger = MagicMock()
|
||||
|
||||
agent._req_socket.recv_json.return_value = {"status": "ok"}
|
||||
|
||||
pause_cmd = PauseCommand(data=True)
|
||||
msg = InternalMessage(to="ri_comm", sender="user_int", body=pause_cmd.model_dump_json())
|
||||
|
||||
await agent.handle_message(msg)
|
||||
|
||||
agent._req_socket.send_json.assert_awaited_once()
|
||||
args = agent._req_socket.send_json.await_args[0][0]
|
||||
assert args["endpoint"] == RIEndpoint.PAUSE.value
|
||||
assert args["data"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_handle_message_invalid_pause_command(zmq_context):
|
||||
"""Test handle_message with invalid JSON."""
|
||||
agent = RICommunicationAgent("ri_comm")
|
||||
agent._req_socket = AsyncMock()
|
||||
agent.logger = MagicMock()
|
||||
|
||||
msg = InternalMessage(to="ri_comm", sender="user_int", body="invalid json")
|
||||
|
||||
await agent.handle_message(msg)
|
||||
|
||||
agent.logger.warning.assert_called_with("Incorrect message format for PauseCommand.")
|
||||
agent._req_socket.send_json.assert_not_called()
|
||||
|
||||
@@ -8,10 +8,6 @@ from control_backend.agents.perception.face_rec_agent import FacePerceptionAgent
|
||||
from control_backend.core.agent_system import InternalMessage
|
||||
from control_backend.schemas.belief_message import BeliefMessage
|
||||
|
||||
# -------------------------
|
||||
# Fixtures
|
||||
# -------------------------
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def agent():
|
||||
@@ -33,11 +29,6 @@ def socket():
|
||||
return sock
|
||||
|
||||
|
||||
# -------------------------
|
||||
# Socket setup tests
|
||||
# -------------------------
|
||||
|
||||
|
||||
def test_connect_socket_connect(agent, socket, monkeypatch):
|
||||
"""Test that _connect_socket properly connects when zmq_bind=False."""
|
||||
ctx = MagicMock()
|
||||
@@ -69,11 +60,6 @@ def test_connect_socket_twice_is_noop(agent, socket):
|
||||
assert agent._socket is socket
|
||||
|
||||
|
||||
# -------------------------
|
||||
# Belief update tests
|
||||
# -------------------------
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_face_belief_present(agent):
|
||||
"""Test that _update_face_belief(True) creates the 'face_present' belief."""
|
||||
@@ -112,11 +98,6 @@ async def test_post_face_belief_absent(agent):
|
||||
assert '"delete"' in msg.body and '"face_present"' in msg.body
|
||||
|
||||
|
||||
# -------------------------
|
||||
# Message handling tests
|
||||
# -------------------------
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_handle_pause(agent):
|
||||
"""Test that a 'PAUSE' message clears _paused and resets _last_face_state."""
|
||||
|
||||
@@ -297,29 +297,6 @@ async def test_send_experiment_control(agent):
|
||||
assert msg.thread == "reset_experiment"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_pause_command(agent):
|
||||
await agent._send_pause_command("true")
|
||||
# Sends to RI and VAD
|
||||
assert agent.send.await_count == 2
|
||||
msgs = [call.args[0] for call in agent.send.call_args_list]
|
||||
|
||||
ri_msg = next(m for m in msgs if m.to == settings.agent_settings.ri_communication_name)
|
||||
assert json.loads(ri_msg.body)["endpoint"] == "" # PAUSE endpoint
|
||||
assert json.loads(ri_msg.body)["data"] is True
|
||||
|
||||
vad_msg = next(m for m in msgs if m.to == settings.agent_settings.vad_name)
|
||||
assert vad_msg.body == "PAUSE"
|
||||
|
||||
agent.send.reset_mock()
|
||||
await agent._send_pause_command("false")
|
||||
assert agent.send.await_count == 2
|
||||
vad_msg = next(
|
||||
m for m in agent.send.call_args_list if m.args[0].to == settings.agent_settings.vad_name
|
||||
).args[0]
|
||||
assert vad_msg.body == "RESUME"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_setup(agent):
|
||||
"""Test the setup method initializes sockets correctly."""
|
||||
|
||||
Reference in New Issue
Block a user