[kimi-task] Add unit tests for src/timmy_serve/voice_tts.py #768

Closed
opened 2026-03-21 19:16:47 +00:00 by Timmy · 1 comment
Owner

Type: Test coverage

File: src/timmy_serve/voice_tts.py

The VoiceTTS class has zero test coverage. Add tests/timmy/test_voice_tts_unit.py with tests for:

  • __init__ with pyttsx3 import failure (mock the import)
  • speak() when not available (should skip gracefully)
  • set_rate() and set_volume() property updates
  • get_voices() when engine is None

Mock pyttsx3 so tests run without audio hardware.

Files to change: 1 new file tests/timmy/test_voice_tts_unit.py

**Type:** Test coverage **File:** `src/timmy_serve/voice_tts.py` The `VoiceTTS` class has zero test coverage. Add `tests/timmy/test_voice_tts_unit.py` with tests for: - `__init__` with pyttsx3 import failure (mock the import) - `speak()` when not available (should skip gracefully) - `set_rate()` and `set_volume()` property updates - `get_voices()` when engine is None Mock `pyttsx3` so tests run without audio hardware. **Files to change:** 1 new file `tests/timmy/test_voice_tts_unit.py`
kimi was assigned by Timmy 2026-03-21 19:16:47 +00:00
Collaborator

PR created with unit tests for voice_tts.py.

Changes:

  • Added tests/timmy/test_voice_tts_unit.py with 280 lines covering all requested test cases
  • 13 new test methods across 6 test classes
  • All tests pass (tox -e unit: 2811 passed, 1 skipped)
  • Format and lint clean

Coverage:

  • __init__ with pyttsx3 import failure (mocked via sys.modules)
  • speak() / speak_sync() when not available (graceful skip)
  • set_rate() and set_volume() property updates (including clamping)
  • get_voices() when engine is None (returns [])
  • set_voice() with/without engine
  • available property

See PR for full details.

PR created with unit tests for `voice_tts.py`. **Changes:** - Added `tests/timmy/test_voice_tts_unit.py` with 280 lines covering all requested test cases - 13 new test methods across 6 test classes - All tests pass (`tox -e unit`: 2811 passed, 1 skipped) - Format and lint clean **Coverage:** - `__init__` with pyttsx3 import failure (mocked via `sys.modules`) - `speak()` / `speak_sync()` when not available (graceful skip) - `set_rate()` and `set_volume()` property updates (including clamping) - `get_voices()` when engine is None (returns `[]`) - `set_voice()` with/without engine - `available` property See PR for full details.
kimi closed this issue 2026-03-21 21:56:46 +00:00
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#768