fix(ci): run coverage report from package directory to fix path matching#17580
Open
chalmerlowe wants to merge 12 commits into
Open
fix(ci): run coverage report from package directory to fix path matching#17580chalmerlowe wants to merge 12 commits into
chalmerlowe wants to merge 12 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the coverage configuration in .coveragerc to use wildcard patterns for omitting initialization files. The reviewer pointed out that using */ requires a leading directory and will fail when running coverage locally from within the package directory. They suggested using *google/cloud/... instead to ensure compatibility in both environments.
5e8a002 to
36ccd3d
Compare
36ccd3d to
4ffa231
Compare
chalmerlowe
commented
Jun 26, 2026
… omit path matching
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.
Fixes coverage evaluation issues in the monorepo by isolating package coverage reports and ensuring correct path matching for
omitrules in local.coveragercfiles.Issue Details
In the CI/CD pipeline (
unittest.yml), coverage reports were being generated pointing to the aggregated.coveragefile in the root. This caused two main problems:coverage reportwithout--includereported on ALL packages present in the aggregated file. Smaller packages with lower coverage (likegoogle-cloud-spanner-dbapi-driver) were artificially dragged up by larger packages with high coverage (likegoogle-cloud-logging), hiding coverage deficits./home/runner/...), whileomitrules in package.coveragercfiles are typically relative paths (e.g.,google/cloud/_testing/__init__.py). This mismatch prevented files from being omitted correctly thus falsely inflating coverage deficits.Solution
--include="$PWD/**"to thecoverage reportcommand inunittest.yml. Combined withpushd "${pkg}", this ensures that:omitpaths in.coveragercmatch correctly against the files being evaluated.google-cloud-spanner-dbapi-driver(89%). It has never had full coverage (and updating that coverage is outside the scope of this PR). We updated its.coveragercwithfail_under = 89to prevent regressions while acknowledging known missing coverage.pytest.skipto prevent system test failures in CI/CD.Note
To ensure the correctness of the fix, we used dummy comments in version files to trigger unittests and cover, but we have removed them to avoid cluttering the PR. The passing results can be seen here