Skip to content

test: add unit tests for build_checks.py and remaining release.py helpers - #183

Merged
pfeerick merged 1 commit into
mainfrom
test/build-checks-and-release-unit-tests
Aug 30, 2026
Merged

pfeerick merged 1 commit into
mainfrom
test/build-checks-and-release-unit-tests

Conversation

@pfeerick

Copy link
Copy Markdown
Member

Summary

Follow-up to #182. 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 translation/sound data could merge unnoticed indefinitely.

  • Renamed build-checks.py → build_checks.py so it's importable as a normal module (a hyphenated filename can't be imported directly). It's still invoked the same way (uv run ./build_checks.py), just updated in both workflow files.
  • Added tests/test_build_checks.py: covers 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 — verified by deliberately breaking the translation-present error/warning distinction and confirming the new test catches it.
  • Extended tests/test_release.py with 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 (already fails loudly via a bare rmdir() on a non-empty dir — pinned with a test so that isn't accidentally softened into a silent rmtree later).

Considered but deliberately left out of scope: the voice-gen-*.py scripts (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 monolithic main() 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 pass
  • uv run ./build_checks.py — unaffected by the rename, still passes against real repo data
  • Confirmed test_check_csv_referenced_files_exist_in_sounds_errors_when_translation_present fails when the translation-present error/warning branch is deliberately inverted, then restored

🤖 Generated with Claude Code

…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>
@pfeerick
pfeerick merged commit 4d3b24a into main Aug 30, 2026
2 checks passed
@pfeerick
pfeerick deleted the test/build-checks-and-release-unit-tests branch August 30, 2026 04:27
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.

1 participant