Merge pull request #22 from AlexanderWhitestone/claude/audit-timmy-dashboard-ft27r

This commit is contained in:
Alexander Whitestone
2026-02-24 14:18:29 -05:00
committed by GitHub
9 changed files with 454 additions and 36 deletions

View File

@@ -27,3 +27,45 @@ def test_status_does_not_use_inline_string():
call_args = mock_timmy.print_response.call_args
assert call_args[0][0] != "Brief status report — one sentence."
def test_chat_sends_message_to_agent():
"""chat command must pass the user message to the agent with streaming."""
mock_timmy = MagicMock()
with patch("timmy.cli.create_timmy", return_value=mock_timmy):
runner.invoke(app, ["chat", "Hello Timmy"])
mock_timmy.print_response.assert_called_once_with("Hello Timmy", stream=True)
def test_think_sends_topic_to_agent():
"""think command must pass the topic wrapped in a prompt with streaming."""
mock_timmy = MagicMock()
with patch("timmy.cli.create_timmy", return_value=mock_timmy):
runner.invoke(app, ["think", "Bitcoin self-custody"])
mock_timmy.print_response.assert_called_once_with(
"Think carefully about: Bitcoin self-custody", stream=True
)
def test_chat_passes_backend_option():
"""chat --backend airllm must forward the backend to create_timmy."""
mock_timmy = MagicMock()
with patch("timmy.cli.create_timmy", return_value=mock_timmy) as mock_create:
runner.invoke(app, ["chat", "test", "--backend", "airllm"])
mock_create.assert_called_once_with(backend="airllm", model_size=None)
def test_think_passes_model_size_option():
"""think --model-size 70b must forward the model size to create_timmy."""
mock_timmy = MagicMock()
with patch("timmy.cli.create_timmy", return_value=mock_timmy) as mock_create:
runner.invoke(app, ["think", "topic", "--model-size", "70b"])
mock_create.assert_called_once_with(backend=None, model_size="70b")

View File

@@ -162,8 +162,8 @@ async def test_coordinator_run_auction_no_bids():
coord = SwarmCoordinator()
task = coord.post_task("No bids task")
# Patch sleep to avoid 15-second wait
with patch("swarm.bidder.asyncio.sleep", new_callable=AsyncMock):
# Patch sleep to avoid 15-second wait in tests
with patch("swarm.coordinator.asyncio.sleep", new_callable=AsyncMock):
winner = await coord.run_auction_and_assign(task.id)
assert winner is None

View File

@@ -8,7 +8,7 @@ These tests verify that:
"""
import asyncio
from unittest.mock import patch
from unittest.mock import AsyncMock, patch
import pytest
@@ -16,6 +16,13 @@ from swarm.coordinator import SwarmCoordinator
from swarm.tasks import TaskStatus
@pytest.fixture(autouse=True)
def _fast_auction():
"""Skip the 15-second auction wait in tests."""
with patch("swarm.coordinator.AUCTION_DURATION_SECONDS", 0):
yield
class TestSwarmInProcessAgents:
"""Test the in-process agent spawning and bidding flow."""

View File

@@ -8,6 +8,13 @@ import pytest
from unittest.mock import AsyncMock, MagicMock, patch
@pytest.fixture(autouse=True)
def _fast_auction():
"""Skip the 15-second auction wait in tests."""
with patch("swarm.coordinator.AUCTION_DURATION_SECONDS", 0):
yield
class TestFullSwarmLifecycle:
"""Integration tests for end-to-end swarm task lifecycle."""