Skip to content

test: add pytest suite with coverage reporting in CI - #50

Merged
JoeMountWSWS merged 1 commit into
mainfrom
test/pytest-coverage
Oct 25, 2026
Merged

JoeMountWSWS merged 1 commit into
mainfrom
test/pytest-coverage

Conversation

@JoeMountWSWS

Copy link
Copy Markdown
Owner

Summary

Adds the repo's first automated test suite, with coverage reporting locally and in CI.

  • tests/: 77 pytest tests (~1s, no network) covering:
    • script.py: scenes, notes, cues, pauses, paragraph gaps, every parse error
    • build.py: frame-accurate timing, reel/landscape, scene stubs, timing injection that keeps edited scenes, index.html, music bed, licensed-font @font-face
    • voice.py: respelling, voice blends, sentence/clause grouping, alignment interpolation, engine selection, ElevenLabs retry/error handling, and the full voice_all cache + align path via a fake TTS engine
    • render.py: SRT grouping/line-breaking, burned-in ASS captions (incl. the DINPro ligature workaround), chapters and YouTube rule warnings
    • CLI: new, status, sync, music (cached), install-skill
    • Regression: demo-paris-commune's committed timing.json must be reproducible from its script and words.json
  • pyproject.toml: dev dependency group (pytest, pytest-cov); [tool.pytest.ini_options] and [tool.coverage] (branch coverage, fail_under = 74; chatterbox_worker.py omitted since it runs in its own venv); ruff isort marks studio/conftest first-party
  • CI: new Tests job on Python 3.12 + 3.13; the coverage table goes to the run summary, and coverage.xml + HTML are uploaded as the coverage artifact. Ruff now also lints tests/, and tests/** triggers CI
  • Docs: a "Tests" section in docs/contributing.md and a pointer in AGENTS.md

Coverage

75.4% total (branch). build 100%, music 100%, script 97%, skill 96%, common 94%, voice 68%, cli 64%, render 57%. The uncovered code is mostly the real Kokoro/Chatterbox/ElevenLabs engines and the ffmpeg/HyperFrames render-and-mix path, which need models and binaries CI doesn't install.

Notes

  • upload-artifact@v4 is pinned; Dependabot (github-actions) will bump it.
  • Only the demo-* episode is used as a fixture, so the tests don't depend on real episodes moving to the private workspace.

Test plan

  • uv run pytest passes on 3.12 and 3.13 locally
  • uvx ruff@0.17.0 check tools/ tests/, uv lock --check
  • mkdocs build --strict
  • CI green on this PR

🤖 Generated with Claude Code

77 tests covering script parsing, timing, project build, narration
caching/alignment (with a fake TTS engine), captions, chapters, the
ElevenLabs retry logic and the new/status/sync/music/install-skill
commands. A regression test checks the demo episode's committed
timing.json still follows from its script and narration.

pytest + pytest-cov in a dev dependency group; coverage config and a
74% fail_under floor in pyproject.toml. CI runs the suite on Python
3.12 and 3.13, writes the coverage table to the run summary and uploads
coverage.xml + HTML as an artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoeMountWSWS
JoeMountWSWS merged commit 6729f14 into main Oct 25, 2026
16 checks passed
@JoeMountWSWS
JoeMountWSWS deleted the test/pytest-coverage branch October 25, 2026 19:23
JoeMountWSWS added a commit that referenced this pull request Oct 25, 2026
77 tests covering script parsing, timing, project build, narration
caching/alignment (with a fake TTS engine), captions, chapters, the
ElevenLabs retry logic and the new/status/sync/music/install-skill
commands. A regression test checks the demo episode's committed
timing.json still follows from its script and narration.

pytest + pytest-cov in a dev dependency group; coverage config and a
74% fail_under floor in pyproject.toml. CI runs the suite on Python
3.12 and 3.13, writes the coverage table to the run summary and uploads
coverage.xml + HTML as an artifact.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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