Skip to content

fix(gapic-generator): add pragma to constants.py to resolve coverage failure and correct if block#17268

Merged
parthea merged 2 commits into
mainfrom
fix/gapic-generator-coverage-fix
May 27, 2026
Merged

fix(gapic-generator): add pragma to constants.py to resolve coverage failure and correct if block#17268
parthea merged 2 commits into
mainfrom
fix/gapic-generator-coverage-fix

Conversation

@chalmerlowe
Copy link
Copy Markdown
Contributor

@chalmerlowe chalmerlowe commented May 27, 2026

During another PR, a failure in the cover nox session pointed at a lack of unit test coverage for this recent addition to the repo. As a constant, there is little benefit to instituting a unit test here. Adds # pragma: NO COVER to constants.py to resolve the 100% coverage check failure.

In addition a select function was inadvertently left out of an if code block to correctly respond when feature does NOT have auto_populated_fields during a recent generator update (~ 20260512).

  • This error only shows up as an issue when code is generated in packages that do not have auto_populated_fields and have been generated very recently. In this case, during updates to google-cloud-logging, we ran into this issue.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a coverage exclusion comment to the UUID4_RE constant in packages/gapic-generator/gapic/utils/constants.py. The reviewer pointed out that the exclusion comment should be in lowercase (# pragma: no cover) instead of uppercase to ensure it is correctly recognized by coverage.py.

Comment thread packages/gapic-generator/gapic/utils/constants.py
@chalmerlowe chalmerlowe marked this pull request as ready for review May 27, 2026 02:19
@chalmerlowe chalmerlowe requested a review from a team as a code owner May 27, 2026 02:19
@chalmerlowe chalmerlowe changed the title fix(gapic-generator): add pragma no cover to constants.py to resolve 100% coverage failure fix(gapic-generator): add pragma to constants.py to resolve coverage failure and correct if block May 27, 2026
@parthea parthea merged commit 1436a23 into main May 27, 2026
92 checks passed
@parthea parthea deleted the fix/gapic-generator-coverage-fix branch May 27, 2026 15:03
parthea pushed a commit that referenced this pull request May 27, 2026
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.15.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:234b9d1f2ddb057ed7ac6a38db0bf8163d839c65c6cf88ade52530cddebce59e
<details><summary>gapic-generator: v1.34.0</summary>

##
[v1.34.0](gapic-generator-v1.33.0...gapic-generator-v1.34.0)
(2026-05-27)

### Bug Fixes

* add pragma to `constants.py` to resolve coverage failure and correct
`if` block (#17268)
([1436a23](1436a23c))

* update incorrect urls in setup.py to point at monorepo vs splitrepo
(#17237)
([eaed04b](eaed04ba))

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants