diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..deb2681 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,5 @@ +[run] +branch = True +source = + ffmpegfyMe +relative_files = True diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 69215a7..057ab14 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -16,7 +16,10 @@ jobs: - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.11" - - run: python -m unittest discover -v + - run: python -m pip install -r requirements-dev.txt + - run: python -m coverage run -m unittest discover -v + - name: Add branch coverage summary + run: python -m coverage report --show-missing --format=markdown >> "$GITHUB_STEP_SUMMARY" container_smoke: name: Container smoke diff --git a/.gitignore b/.gitignore index e3a1731..1314a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ __pycache__/ *.pyc *.pyo .env +.coverage +.venv/ # Editor/OS metadata .DS_Store diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 79de319..b352063 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,19 @@ Common types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, ## Tests and CI -- Run the Python test suite locally with `python3 -m unittest discover -v`. +Use an isolated virtual environment to run tests with branch coverage: + +```sh +python3 -m venv .venv +.venv/bin/python -m pip install -r requirements-dev.txt +.venv/bin/python -m coverage run -m unittest discover -v +.venv/bin/python -m coverage report --show-missing +``` + +The reported `ffmpegfyMe.py` percentage combines deterministic policy and +integration code. It is a module-level baseline, not core-policy-only +coverage. Issue #32 defines the target scope. + - The Python test suite runs on PRs and pushes to main. - Watch the required CI checks on the pull request and run the current CI checks before requesting review. diff --git a/README.md b/README.md index a553de1..54a6b3d 100644 --- a/README.md +++ b/README.md @@ -152,11 +152,7 @@ task ffmpegfy:run ## Tests -Run the Python test suite: - -```bash -python3 -m unittest discover -v -``` +Run the Python test suite with branch coverage. See [CONTRIBUTING.md](CONTRIBUTING.md#tests-and-ci) for the local environment and commands. GitHub Actions runs it on pull requests to `main` and pushes to `main`. diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..f76ca6c --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +coverage==7.17.0