Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1436a23

Browse filesBrowse files
authored
fix(gapic-generator): add pragma to constants.py to resolve coverage failure and correct if block (#17268)
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.
1 parent 65da316 commit 1436a23
Copy full SHA for 1436a23

2 files changed

+2-2Lines changed: 2 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2‎

Copy file name to clipboardExpand all lines: packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ CRED_INFO_JSON = {
107107
"principal": "service-account@example.com",
108108
}
109109
CRED_INFO_STRING = json.dumps(CRED_INFO_JSON)
110-
{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|list %}
110+
{% if api.all_method_settings.values()|map(attribute="auto_populated_fields", default=[])|select|list %}
111111
_UUID4_RE = re.compile(r"{{ uuid4_re }}")
112112
{% endif %}
113113

Collapse file

‎packages/gapic-generator/gapic/utils/constants.py‎

Copy file name to clipboardExpand all lines: packages/gapic-generator/gapic/utils/constants.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# The regex for a UUID4 as specified in AIP-4235.
16-
UUID4_RE = r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}"
16+
UUID4_RE = r"[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}" # pragma: NO COVER

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.