Repository navigation
test: add unit tests for build_checks.py and remaining release.py helpers - #183
Merged
Merged
Conversation
…pers build_checks.py runs on every push/PR (unlike release.py, which only runs at release time) but had zero test coverage across its ~12 independent validation functions. A silent false-negative there wouldn't fail the build at all, so bad data could merge unnoticed. - Rename build-checks.py -> build_checks.py so it's importable as a normal module (a hyphenated filename can't be `import`ed directly). - Add tests/test_build_checks.py covering each check function against small synthetic voices/SOUNDS fixtures, including the warning-vs-error branches (blank translation, warning-only CSV files) that are easy to invert by mistake - confirmed by deliberately breaking the translation-present error/warning distinction and watching the new test catch it. - Add tests/test_release.py coverage for the remaining untested release.py helpers: run_checked (exit-code -> exception mapping), env_flags, recreate_release_dir, create_release_directories, and remove_root_sounds_dir (which already fails loudly via a bare rmdir() on a non-empty dir - pinned so that isn't accidentally softened later). Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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
Follow-up to #182.
build_checks.pyruns on every push/PR (unlikerelease.py, which only runs at release time) but had zero test coverage across its ~12 independent validation functions. A silent false-negative there wouldn't fail the build at all, so bad translation/sound data could merge unnoticed indefinitely.build-checks.py→build_checks.pyso it's importable as a normal module (a hyphenated filename can't beimported directly). It's still invoked the same way (uv run ./build_checks.py), just updated in both workflow files.tests/test_build_checks.py: covers each check function against small syntheticvoices//SOUNDS/fixtures, including the warning-vs-error branches (blank translation, warning-only CSV files) that are easy to invert by mistake — verified by deliberately breaking the translation-present error/warning distinction and confirming the new test catches it.tests/test_release.pywith the remaining untestedrelease.pyhelpers:run_checked(exit-code → exception mapping),env_flags,recreate_release_dir,create_release_directories, andremove_root_sounds_dir(already fails loudly via a barermdir()on a non-empty dir — pinned with a test so that isn't accidentally softened into a silentrmtreelater).Considered but deliberately left out of scope: the
voice-gen-*.pyscripts (also hyphenated) never run in CI — they're manual tools a maintainer runs by hand against paid TTS APIs, so bugs surface immediately and visibly rather than silently. They're also structured as one monolithicmain()rather than composed of testable pure functions, so getting real test value out of them would mean refactoring first — a separate, more invasive piece of work.Test plan
uv run pytest— 43 tests passuv run ./build_checks.py— unaffected by the rename, still passes against real repo datatest_check_csv_referenced_files_exist_in_sounds_errors_when_translation_presentfails when the translation-present error/warning branch is deliberately inverted, then restored🤖 Generated with Claude Code