test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
"""Functional tests for timmy_serve.voice_tts — TTS engine lifecycle.
|
|
|
|
|
|
|
|
|
|
pyttsx3 is not available in CI, so all tests mock the engine.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import threading
|
ruff (#169)
* polish: streamline nav, extract inline styles, improve tablet UX
- Restructure desktop nav from 8+ flat links + overflow dropdown into
5 grouped dropdowns (Core, Agents, Intel, System, More) matching
the mobile menu structure to reduce decision fatigue
- Extract all inline styles from mission_control.html and base.html
notification elements into mission-control.css with semantic classes
- Replace JS-built innerHTML with secure DOM construction in
notification loader and chat history
- Add CONNECTING state to connection indicator (amber) instead of
showing OFFLINE before WebSocket connects
- Add tablet breakpoint (1024px) with larger touch targets for
Apple Pencil / stylus use and safe-area padding for iPad toolbar
- Add active-link highlighting in desktop dropdown menus
- Rename "Mission Control" page title to "System Overview" to
disambiguate from the chat home page
- Add "Home — Timmy Time" page title to index.html
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* fix(security): move auth-gate credentials to environment variables
Hardcoded username, password, and HMAC secret in auth-gate.py replaced
with os.environ lookups. Startup now refuses to run if any variable is
unset. Added AUTH_GATE_SECRET/USER/PASS to .env.example.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
* refactor(tooling): migrate from black+isort+bandit to ruff
Replace three separate linting/formatting tools with a single ruff
invocation. Updates tox.ini (lint, format, pre-push, pre-commit envs),
.pre-commit-config.yaml, and CI workflow. Fixes all ruff errors
including unused imports, missing raise-from, and undefined names.
Ruff config maps existing bandit skips to equivalent S-rules.
https://claude.ai/code/session_015uPUoKyYa8M2UAcyk5Gt6h
---------
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-11 12:23:35 -04:00
|
|
|
from unittest.mock import MagicMock, patch
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestVoiceTTS:
|
|
|
|
|
"""Test TTS engine initialization, speak, and configuration."""
|
|
|
|
|
|
|
|
|
|
def test_init_success(self):
|
|
|
|
|
mock_pyttsx3 = MagicMock()
|
|
|
|
|
mock_engine = MagicMock()
|
|
|
|
|
mock_pyttsx3.init.return_value = mock_engine
|
|
|
|
|
|
|
|
|
|
with patch.dict("sys.modules", {"pyttsx3": mock_pyttsx3}):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS(rate=200, volume=0.8)
|
|
|
|
|
assert tts.available is True
|
|
|
|
|
mock_engine.setProperty.assert_any_call("rate", 200)
|
|
|
|
|
mock_engine.setProperty.assert_any_call("volume", 0.8)
|
|
|
|
|
|
|
|
|
|
def test_init_failure_graceful(self):
|
|
|
|
|
"""When pyttsx3 import fails, VoiceTTS degrades gracefully."""
|
|
|
|
|
with patch.dict("sys.modules", {"pyttsx3": None}):
|
|
|
|
|
import timmy_serve.voice_tts as mod
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = mod.VoiceTTS.__new__(mod.VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
tts._rate = 175
|
|
|
|
|
tts._volume = 0.9
|
|
|
|
|
tts._available = False
|
|
|
|
|
tts._lock = threading.Lock()
|
|
|
|
|
assert tts.available is False
|
|
|
|
|
|
|
|
|
|
def test_speak_skips_when_unavailable(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
tts._available = False
|
|
|
|
|
tts._lock = threading.Lock()
|
|
|
|
|
# Should not raise
|
|
|
|
|
tts.speak("hello")
|
|
|
|
|
|
|
|
|
|
def test_speak_sync_skips_when_unavailable(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
tts._available = False
|
|
|
|
|
tts._lock = threading.Lock()
|
|
|
|
|
tts.speak_sync("hello")
|
|
|
|
|
|
|
|
|
|
def test_speak_calls_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._available = True
|
|
|
|
|
tts._lock = threading.Lock()
|
|
|
|
|
|
2026-02-26 22:52:36 -05:00
|
|
|
# Patch threading.Thread to capture the thread and join it
|
|
|
|
|
original_thread_class = threading.Thread
|
|
|
|
|
captured_threads = []
|
|
|
|
|
|
|
|
|
|
def capture_thread(*args, **kwargs):
|
|
|
|
|
t = original_thread_class(*args, **kwargs)
|
|
|
|
|
captured_threads.append(t)
|
|
|
|
|
return t
|
|
|
|
|
|
|
|
|
|
with patch.object(threading, "Thread", side_effect=capture_thread):
|
|
|
|
|
tts.speak("test speech")
|
|
|
|
|
# Wait for the background thread to complete
|
|
|
|
|
for t in captured_threads:
|
|
|
|
|
t.join(timeout=1)
|
|
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts._engine.say.assert_called_with("test speech")
|
|
|
|
|
|
|
|
|
|
def test_speak_sync_calls_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._available = True
|
|
|
|
|
tts._lock = threading.Lock()
|
|
|
|
|
|
|
|
|
|
tts.speak_sync("sync test")
|
|
|
|
|
tts._engine.say.assert_called_with("sync test")
|
|
|
|
|
tts._engine.runAndWait.assert_called_once()
|
|
|
|
|
|
|
|
|
|
def test_set_rate(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._rate = 175
|
|
|
|
|
|
|
|
|
|
tts.set_rate(220)
|
|
|
|
|
assert tts._rate == 220
|
|
|
|
|
tts._engine.setProperty.assert_called_with("rate", 220)
|
|
|
|
|
|
|
|
|
|
def test_set_rate_no_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
tts._rate = 175
|
|
|
|
|
tts.set_rate(220)
|
|
|
|
|
assert tts._rate == 220
|
|
|
|
|
|
|
|
|
|
def test_set_volume_clamped(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._volume = 0.9
|
|
|
|
|
|
|
|
|
|
tts.set_volume(1.5)
|
|
|
|
|
assert tts._volume == 1.0
|
|
|
|
|
|
|
|
|
|
tts.set_volume(-0.5)
|
|
|
|
|
assert tts._volume == 0.0
|
|
|
|
|
|
|
|
|
|
tts.set_volume(0.7)
|
|
|
|
|
assert tts._volume == 0.7
|
|
|
|
|
|
|
|
|
|
def test_get_voices_no_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
assert tts.get_voices() == []
|
|
|
|
|
|
|
|
|
|
def test_get_voices_with_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
mock_voice = MagicMock()
|
|
|
|
|
mock_voice.id = "voice1"
|
|
|
|
|
mock_voice.name = "Default"
|
|
|
|
|
mock_voice.languages = ["en"]
|
|
|
|
|
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._engine.getProperty.return_value = [mock_voice]
|
|
|
|
|
|
|
|
|
|
voices = tts.get_voices()
|
|
|
|
|
assert len(voices) == 1
|
|
|
|
|
assert voices[0]["id"] == "voice1"
|
|
|
|
|
assert voices[0]["name"] == "Default"
|
|
|
|
|
assert voices[0]["languages"] == ["en"]
|
|
|
|
|
|
|
|
|
|
def test_get_voices_exception(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts._engine.getProperty.side_effect = RuntimeError("no voices")
|
|
|
|
|
assert tts.get_voices() == []
|
|
|
|
|
|
|
|
|
|
def test_set_voice(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = MagicMock()
|
|
|
|
|
tts.set_voice("voice_id_1")
|
|
|
|
|
tts._engine.setProperty.assert_called_with("voice", "voice_id_1")
|
|
|
|
|
|
|
|
|
|
def test_set_voice_no_engine(self):
|
|
|
|
|
from timmy_serve.voice_tts import VoiceTTS
|
2026-02-26 22:52:36 -05:00
|
|
|
|
test: add 157 functional tests covering 8 low-coverage modules
Analyze test coverage (75.3% → 85.4%) and add functional test suites
for the major gaps identified:
- test_agent_core.py: Full coverage for agent_core/interface.py (0→100%)
and agent_core/ollama_adapter.py (0→100%) — data classes, factories,
abstract enforcement, perceive/reason/act/recall workflow, effect logging
- test_docker_runner.py: Full coverage for swarm/docker_runner.py (0→100%)
— container spawn/stop/list lifecycle with mocked subprocess
- test_timmy_tools.py: Tool usage tracking, persona toolkit mapping,
catalog generation, graceful degradation without Agno
- test_routes_tools.py: /tools page, API stats endpoint, and WebSocket
/swarm/live connect/disconnect/send lifecycle (41→82%)
- test_voice_tts_functional.py: VoiceTTS init, speak, volume clamping,
voice listing, graceful degradation (41→94%)
- test_watchdog_functional.py: _run_tests, watch loop state transitions,
regression detection, KeyboardInterrupt (47→97%)
- test_lnd_backend.py: LND init from params/env, grpc stub enforcement,
method-level BackendNotAvailableError, settle returns False (25→61%)
- test_swarm_routes_functional.py: Agent spawn/stop, task CRUD, auction,
insights, UI partials, error paths (63→92%)
https://claude.ai/code/session_01WU4h3cQQiouMwmgYmAgkMM
2026-02-24 23:36:50 +00:00
|
|
|
tts = VoiceTTS.__new__(VoiceTTS)
|
|
|
|
|
tts._engine = None
|
|
|
|
|
tts.set_voice("voice_id_1") # should not raise
|