Repository navigation
Fix TestBigQueryEndpoint to mock gcp_bigquery module instead of gcp_bigquery.Client - #40746
Conversation
|
/gemini review |
There was a problem hiding this comment.
📋 Review Summary
This PR updates TestBigQueryEndpoint in bigquery_tools_test.py to mock apache_beam.io.gcp.bigquery_tools.gcp_bigquery directly instead of bigquery_tools.gcp_bigquery.Client. This prevents AttributeError when running tests in environments where apitools is installed (HttpError is not None) but google-cloud-bigquery is not (gcp_bigquery is None).
🔍 General Feedback
- The changes are clean, accurate, and directly align with the existing mocking pattern used in
TestBigQueryWrapperQuotaProjectwithin the same test file.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40746 +/- ##
==========================================
- Coverage 80.04% 79.93% -0.12%
==========================================
Files 490 493 +3
Lines 82916 83402 +486
==========================================
+ Hits 66373 66664 +291
- Misses 16543 16738 +195
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Assigning reviewers: R: @jrmccluskey for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
In environments where apitools is available (HttpError is not None) but google-cloud-bigquery is not installed, bigquery_tools.gcp_bigquery is None and @mock.patch.object(bigquery_tools.gcp_bigquery, 'Client') fails with
AttributeError. Patch 'apache_beam.io.gcp.bigquery_tools.gcp_bigquery' directly. Similar to https://github.com/apache/beam/pull/40676/changes.