There are four problems with
pytest code coverage out-of-the-box.
- It doesn't check subfolders be default.
- It includes the test(s) directory which biases the total code coverage upwards.
- It doesn't return an exit code if the code coverage threshold is not met.
- It doesn't allow setting a minimum code coverage threshold for individual files.
Points 1 and 2 can be solved by using a
.coveragerc file, but having to manually update the file can become cumbersome fast.
The GitHub Action I've written aims to solve all of these issues. I also provide a sample workflow file that uses two other actions as well to automatically create issues and commit comments in your repo with the
pytest code coverage table as a markdown table.
If you find the video helpful you can greatly help me by doing one or all of: