-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage environment in Tox does not measure coverage accurately #80
Comments
Note that as part of #79 we |
Here is an example tox.ini from pytest-codecov: https://github.com/seantis/pytest-codecov/blob/master/tox.ini Basically you are always measuring coverage for every test environment in a coverage file specific to that environment and all the report environment does is take the existing coverage files and combining them. pytest-cov makes this a little less cumbersome, but you could certainly accomplish the same results without it. In the CI case with the additional testruns for postgres you would have to create two additional coverage files per environment. (Or four if you look at all permutations, but only ever two of them will be active in the same environment) |
Coveralls also supports multiple uploads and combines them. To get a real coverage number only each action run needs to report to coveralls. |
The environment for coverage currently only is run on a specific Python/SQLAlchemy version and without the two Postgres specific test-runs on the CI, as such it does not accurately represent the coverage.
I have found that the best way to do coverage reports with tox and multiple environments is to set the environment variable that changes the name of the
.coverage
file, so each environment calculates the coverage and creates a unique file. Then at the end you run your report environment to stitch them together.On the CI you would either have to create Artifacts and use them in a final dependent runner that stitches them together, or possibly coveralls supports stitching them together for you, if you upload multiple coverage reports from the same commit. (I know Codecov supports uploading multiple reports and stitches them together for you, but I have never used coveralls)
The text was updated successfully, but these errors were encountered: