Open
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: palakpsheth <13122115+palakpsheth@users.noreply.github.com>
Co-authored-by: palakpsheth <13122115+palakpsheth@users.noreply.github.com>
[WIP] Add subgen test suite and CI workflow
…ilot/sub-pr-1-again # Conflicts: # .gitignore
Apply review feedback: fix fixture ordering and remove unused import
Add subgen test suite and CI workflow
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive test suite for the subgen project using pytest. The test suite includes 57 test cases covering various functionality of the subtitle generation system, from webhook handling to audio processing and file operations.
Changes:
- Added comprehensive pytest-based test suite with 57 test cases
- Implemented GitHub Actions CI workflow for automated testing
- Added pytest configuration and updated .gitignore for test artifacts
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_subgen.py | Implements 57 test cases covering core functionality including webhooks, audio processing, subtitle generation, and file operations |
| tests/conftest.py | Provides pytest fixture that stubs all heavy dependencies (fastapi, stable-whisper, ffmpeg, etc.) allowing tests to run with minimal dependencies |
| pytest.ini | Configures pytest with pythonpath to enable imports from project root |
| .gitignore | Adds Python test artifacts (pycache, .coverage, coverage.xml, htmlcov/) |
| .github/workflows/tests.yml | Sets up CI pipeline with Python 3.11, runs pytest with coverage reporting, and uploads coverage artifacts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Overview
This PR adds a full pytest-based unit test suite for
subgen.pyand wires up CI to run those tests with coverage. The tests are designed to maximize coverage while avoiding heavy runtime dependencies by using lightweight stubs for external libraries (FastAPI, stable-whisper, ffmpeg/av, requests, watchdog, torch).Key changes
tests/conftest.pywith dependency stubs + asubgen_modulefixture that:CONCURRENT_TRANSCRIPTIONS=0) and filesystem monitortests/test_subgen.pywith broad coverage for:convert_to_bool,get_env_with_fallback)DeduplicatedQueue)has_audio, etc.)pytest.inito ensure repo root is onPYTHONPATH.github/workflows/tests.ymlto runpyteston push/PR and uploadcoverage.xml.gitignoreto keep__pycache__,*.pyc, and coverage artifacts out of gitTesting
pytest -q --cov=subgen --cov-report=term-missing --cov-report=xmlCoverage
coverage.xmlas an artifact.subgen.pyexecution paths; external dependencies are stubbed, so this does not validate real FFmpeg/AV/Whisper integrations.Notes / limitations