Skip to content

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 3, 2026

Summary

Improves test coverage for the audio module, closing #8.

Coverage Results

Module Before After
player.py 66% 96%
tts_engine.py 63% 97%
Total 65% 96%

Tests Added (36 new tests)

player.py tests:

  • BASS audio system initialization and cleanup
  • BASS init failure propagation
  • Fallback playback via playsound3 threading
  • Fallback ImportError and general exception handling
  • Volume updates on active sound_lib streams
  • is_playing exception handling
  • stop() exception recovery (stream set to None)
  • BASS_Free error handling during cleanup

tts_engine.py tests:

  • pyttsx3 initialization success and failure paths
  • Speech synthesis error handling
  • Voice listing exception handling
  • Voice selection by ID (not just name)
  • Voice not found case
  • Voice selection exception handling
  • Rate setter with engine property update
  • Cleanup with engine.stop() and exception suppression
  • Natural time format edge cases (quarter-to, non-standard minutes)
  • speak_time with all options (style + date)

Remaining Uncovered Lines

  • player.py lines 24-25, 28-29: Module-level import branches for sound_lib (can't be hit without module reload)
  • tts_engine.py lines 22-24, 182: Module-level pyttsx3 import and list_voices exception log line

Closes #8

- player.py: 66% → 96% coverage
- tts_engine.py: 63% → 97% coverage
- Added tests for BASS init/cleanup, fallback playback, volume
  updates during active playback, error handling paths, voice
  selection by ID, speech synthesis errors, and cleanup methods
- Total audio module: 30→66 tests (36 new tests added)

Closes #8
@Orinks
Copy link
Owner Author

Orinks commented Feb 4, 2026

Superseded by PR #10 which was merged with the same coverage improvements.

@Orinks Orinks closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants