Rules for writing and running tests. Project-wide rules are in the root AGENTS.md.
- pytest. One file per module:
tests/test_<module>.pycoverssrc/subsync/<module>.py. Most files group tests intoTest<Thing>classes; follow the file you are in. - Write tests with every piece of logic, especially edge cases. Prefer unit tests for pure functions.
- Tests are deterministic and make no network calls. yt-dlp and Whisper are replaced with
unittest.mockstand-ins (@patch("subsync.transcriber.whisper")); the default run never downloads a model or a video. - Use pytest's
tmp_pathfor files; never write into the repository. - Run everything with
task test; one test withuv run pytest tests/test_file.py::TestClass::test_name.task lintmust pass too.
Slice S1 adds the layers agreed in E7: integration tests with real FFmpeg on media generated at test time, an SRT invariant checker written from the requirements (not from the processor), and an opt-in end-to-end run (pytest -m e2e) with Whisper tiny on a clip made with macOS say. The e2e tests are skipped by default and wherever say or FFmpeg is missing. Details: phase 4 plan, Testing Strategy (E7). There is no CI until slice S5 (0010), so these checks run locally.