fix: failing tests and warnings
ref: N25B-449
This commit is contained in:
@@ -48,6 +48,7 @@ test = [
|
||||
"pytest-asyncio>=1.2.0",
|
||||
"pytest-cov>=7.0.0",
|
||||
"pytest-mock>=3.15.1",
|
||||
"python-slugify>=8.0.4",
|
||||
"pyyaml>=6.0.3",
|
||||
"pyzmq>=27.1.0",
|
||||
"soundfile>=0.13.1",
|
||||
|
||||
@@ -202,7 +202,7 @@ class UserInterruptAgent(BaseAgent):
|
||||
goal_name = msg.body
|
||||
ui_id = self._goal_reverse_map.get(goal_name)
|
||||
if ui_id:
|
||||
payload = {"type": "goal_update", "id": ui_id}
|
||||
payload = {"type": "goal_update", "id": ui_id, "active": True}
|
||||
await self._send_experiment_update(payload)
|
||||
self.logger.info(f"UI Update: Goal {goal_name} started (ID: {ui_id})")
|
||||
case "active_norms_update":
|
||||
@@ -361,6 +361,8 @@ class UserInterruptAgent(BaseAgent):
|
||||
thread = "force_next_phase"
|
||||
case "reset_phase":
|
||||
thread = "reset_current_phase"
|
||||
case "reset_experiment":
|
||||
thread = "reset_experiment"
|
||||
case _:
|
||||
self.logger.warning(
|
||||
"Received unknown experiment control type '%s' to send to BDI Core.",
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
from fastapi.routing import APIRouter
|
||||
|
||||
from control_backend.api.v1.endpoints import logs, message, program, robot, sse, user_interact
|
||||
from control_backend.api.v1.endpoints import logs, message, program, robot, user_interact
|
||||
|
||||
api_router = APIRouter()
|
||||
|
||||
api_router.include_router(message.router, tags=["Messages"])
|
||||
|
||||
api_router.include_router(sse.router, tags=["SSE"])
|
||||
|
||||
api_router.include_router(robot.router, prefix="/robot", tags=["Pings", "Commands"])
|
||||
|
||||
api_router.include_router(logs.router, tags=["Logs"])
|
||||
|
||||
@@ -40,7 +40,7 @@ async def test_normal_setup(per_transcription_agent):
|
||||
per_vad_agent = VADAgent("tcp://localhost:12345", False)
|
||||
per_vad_agent._streaming_loop = AsyncMock()
|
||||
|
||||
async def swallow_background_task(coro):
|
||||
def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
@@ -106,7 +106,7 @@ async def test_out_socket_creation_failure(zmq_context):
|
||||
per_vad_agent._streaming_loop = AsyncMock()
|
||||
per_vad_agent._connect_audio_out_socket = MagicMock(return_value=None)
|
||||
|
||||
async def swallow_background_task(coro):
|
||||
def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
@@ -126,7 +126,7 @@ async def test_stop(zmq_context, per_transcription_agent):
|
||||
per_vad_agent._reset_stream = AsyncMock()
|
||||
per_vad_agent._streaming_loop = AsyncMock()
|
||||
|
||||
async def swallow_background_task(coro):
|
||||
def swallow_background_task(coro):
|
||||
coro.close()
|
||||
|
||||
per_vad_agent.add_behavior = swallow_background_task
|
||||
@@ -150,6 +150,7 @@ async def test_application_startup_complete(zmq_context):
|
||||
vad_agent._running = True
|
||||
vad_agent._reset_stream = AsyncMock()
|
||||
vad_agent.program_sub_socket = AsyncMock()
|
||||
vad_agent.program_sub_socket.close = MagicMock()
|
||||
vad_agent.program_sub_socket.recv_multipart.side_effect = [
|
||||
(PROGRAM_STATUS, ProgramStatus.RUNNING.value),
|
||||
]
|
||||
|
||||
@@ -63,7 +63,7 @@ async def test_send_to_bdi_belief(agent):
|
||||
"""Verify belief update format."""
|
||||
context_str = "some_goal"
|
||||
|
||||
await agent._send_to_bdi_belief(context_str)
|
||||
await agent._send_to_bdi_belief(context_str, "goal")
|
||||
|
||||
assert agent.send.await_count == 1
|
||||
sent_msg = agent.send.call_args.args[0]
|
||||
@@ -115,7 +115,7 @@ async def test_receive_loop_routing_success(agent):
|
||||
agent._send_to_gesture_agent.assert_awaited_once_with("Hello Gesture")
|
||||
|
||||
# Override (since we mapped it to a goal)
|
||||
agent._send_to_bdi_belief.assert_awaited_once_with("some_goal_slug")
|
||||
agent._send_to_bdi_belief.assert_awaited_once_with("some_goal_slug", "goal")
|
||||
|
||||
assert agent._send_to_speech_agent.await_count == 1
|
||||
assert agent._send_to_gesture_agent.await_count == 1
|
||||
|
||||
@@ -11,6 +11,5 @@ def test_router_includes_expected_paths():
|
||||
# Ensure at least one route under each prefix exists
|
||||
assert any(p.startswith("/robot") for p in paths)
|
||||
assert any(p.startswith("/message") for p in paths)
|
||||
assert any(p.startswith("/sse") for p in paths)
|
||||
assert any(p.startswith("/logs") for p in paths)
|
||||
assert any(p.startswith("/program") for p in paths)
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from control_backend.api.v1.endpoints import sse
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app():
|
||||
app = FastAPI()
|
||||
app.include_router(sse.router)
|
||||
return app
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(app):
|
||||
return TestClient(app)
|
||||
|
||||
|
||||
def test_sse_route_exists(client):
|
||||
"""Minimal smoke test to ensure /sse route exists and responds."""
|
||||
response = client.get("/sse")
|
||||
# Since implementation is not done, we only assert it doesn't crash
|
||||
assert response.status_code == 200
|
||||
4
uv.lock
generated
4
uv.lock
generated
@@ -1,5 +1,5 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
revision = 2
|
||||
requires-python = ">=3.13"
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.14'",
|
||||
@@ -1030,6 +1030,7 @@ test = [
|
||||
{ name = "pytest-asyncio" },
|
||||
{ name = "pytest-cov" },
|
||||
{ name = "pytest-mock" },
|
||||
{ name = "python-slugify" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "pyzmq" },
|
||||
{ name = "soundfile" },
|
||||
@@ -1080,6 +1081,7 @@ test = [
|
||||
{ name = "pytest-asyncio", specifier = ">=1.2.0" },
|
||||
{ name = "pytest-cov", specifier = ">=7.0.0" },
|
||||
{ name = "pytest-mock", specifier = ">=3.15.1" },
|
||||
{ name = "python-slugify", specifier = ">=8.0.4" },
|
||||
{ name = "pyyaml", specifier = ">=6.0.3" },
|
||||
{ name = "pyzmq", specifier = ">=27.1.0" },
|
||||
{ name = "soundfile", specifier = ">=0.13.1" },
|
||||
|
||||
Reference in New Issue
Block a user