Include test suite in code coverage #545
Merged
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.
Include the test suite in code coverage, via the coverage.run.source setting.
Rationale:
Caveats:
--skip-covered
if this is an issue.See https://nedbatchelder.com/blog/202008/you_should_include_your_tests_in_coverage.html
This PR also updates the coverage.paths setting, to map paths for the test suite to the local source tree. By default, coverage data contains absolute paths for the test suite. During CI, coverage data from various runners is combined in an environment where these paths do not exist. This results in errors like the following:
The coverage.run.relative_files setting is not an option here due to nedbat/coveragepy#991: Windows paths are stored with backslashes, triggering
No source
errors when the coverage data is combined on other platforms, such as the Ubuntu runner used in our coverage job:Note the backslash in the filename reported in the error message. If that upstream issue was fixed, we'd still need
coverage.paths
forsrc
though. This is because relative paths for the installed package still include the location of the various Nox environments.