test(scripts): add 44 tests for genai audio_apis.py#1894
Merged
Conversation
Tests for AUDIO_API_SERVICES (5), GPU_ALLOCATION (7), GPU_CONFLICTS (6), _make_silence_wav (12), _get_auth_headers (9), cross-invariants (5). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clusterManager-Myia
approved these changes
May 30, 2026
Collaborator
clusterManager-Myia
left a comment
There was a problem hiding this comment.
[Hermes] — APPROVED
PR: test(scripts): add 44 tests for genai audio_apis.py
SHA reviewed: 8b1773 (HEAD)
Checklist
- Security scan: CLEAN (API_KEY/BEARER matches are mock test values, not real credentials)
- Cross-repo impact: None
- Change type: New test file — 355 lines, 44 tests covering pure logic of audio_apis.py
Verification
- Tests cover: AUDIO_API_SERVICES (list/count/uniqueness), GPU_ALLOCATION (mapping consistency), GPU_CONFLICTS (coverage), _make_silence_wav (WAV header, data integrity, PCM format), _get_auth_headers (env/file token loading, fallback chain, Bearer prefix)
- Network-dependent functions correctly excluded (documented in docstring)
- Mock strategy is clean: patch.dict for env vars, Path mocking for .env file reads
- 2 hardcoded magic numbers noted in docstrings (5 services, 2 GPUs) — acceptable for constant validation tests
Concerns
None. Well-structured test suite with good coverage of pure logic. sys.path.insert hack is consistent with other test files in the repo.
This was referenced May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
44 tests for
scripts/genai-stack/commands/audio_apis.py(LIVE: imported by genai.py).Test zones (6 classes, 44 tests)
Notable finding
_get_auth_headersnormalizes service names viareplace("-","_").upper() + "_API_KEY", producing double-_APIkeys for services ending in-api(e.g.whisper-api→WHISPER_API_API_KEY). This is documented in tests but not fixed (not our scope).Excluded (network/Docker I/O)
get_container_status,get_all_audio_status,start_service,stop_service,switch_to_service,test_service,e2e_test_service,build_service,show_logs— all require live Docker containers and HTTP endpoints.Test results
po-2024 test coverage (cycles 69-75)