Skip to content

[test] - #18081

Closed
hebaalazzeh wants to merge 2 commits into
mainfrom
update-gapic-generator-v1.38-v2
Closed

[test]#18081
hebaalazzeh wants to merge 2 commits into
mainfrom
update-gapic-generator-v1.38-v2

Conversation

@hebaalazzeh

Copy link
Copy Markdown
Contributor

No description provided.

@hebaalazzeh hebaalazzeh self-assigned this Aug 12, 2026
@hebaalazzeh hebaalazzeh changed the title [test]Update gapic generator v1.38 v2 [test] Aug 12, 2026

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

Copy link
Copy Markdown
Contributor

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 refactors the google-cloud-language package across versions v1, v1beta2, and v2 by introducing a shared _compat.py module to handle fallback logic for older versions of google-api-core. It simplifies REST transports by delegating request transcoding to this new module, removes obsolete manual Python and dependency version checks, and bumps the minimum required google-api-core version to 2.28.0. Feedback on the newly added unit tests highlights a style guide violation where path_template.transcode is mocked globally instead of using its localized module import path.

Comment on lines +364 to +367
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the repository style guide, standard functions or external helpers should be mocked using their local module import path rather than patching them globally. This ensures that mocks remain isolated and do not leak or affect other tests.

Please update the mock patch to target the local import path google.cloud.language_v1._compat.path_template.transcode.

Suggested change
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
with mock.patch(
"google.cloud.language_v1._compat.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
References
  1. When mocking standard functions or filesystem checks, mock the local module import path instead of patching globally, ensuring mocks are isolated. (link)

Comment on lines +364 to +367
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the repository style guide, standard functions or external helpers should be mocked using their local module import path rather than patching them globally. This ensures that mocks remain isolated and do not leak or affect other tests.

Please update the mock patch to target the local import path google.cloud.language_v1beta2._compat.path_template.transcode.

Suggested change
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
with mock.patch(
"google.cloud.language_v1beta2._compat.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
References
  1. When mocking standard functions or filesystem checks, mock the local module import path instead of patching globally, ensuring mocks are isolated. (link)

Comment on lines +364 to +367
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the repository style guide, standard functions or external helpers should be mocked using their local module import path rather than patching them globally. This ensures that mocks remain isolated and do not leak or affect other tests.

Please update the mock patch to target the local import path google.cloud.language_v2._compat.path_template.transcode.

Suggested change
with mock.patch(
"google.api_core.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
with mock.patch(
"google.cloud.language_v2._compat.path_template.transcode",
return_value={"method": "get", "uri": "/v1/test"},
):
References
  1. When mocking standard functions or filesystem checks, mock the local module import path instead of patching globally, ensuring mocks are isolated. (link)

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.

1 participant