Skip to content

Fix TestBigQueryEndpoint to mock gcp_bigquery module instead of gcp_bigquery.Client - #40746

Merged
jrmccluskey merged 1 commit into
apache:masterfrom
derrickaw:20261023_fixBQTools
Oct 23, 2026
Merged

jrmccluskey merged 1 commit into
apache:masterfrom
derrickaw:20261023_fixBQTools

Conversation

@derrickaw

Copy link
Copy Markdown
Collaborator

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.

@github-actions github-actions Bot added python io gcp size/s S: 10-49 lines changed labels Oct 23, 2026
@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions 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.

📋 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 TestBigQueryWrapperQuotaProject within the same test file.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.93%. Comparing base (a8d6afd) to head (1fd31b8).
⚠️ Report is 60 commits behind head on master.

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     
Flag Coverage Δ
python 79.93% <ø> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@derrickaw
derrickaw marked this pull request as ready for review October 23, 2026 16:12
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @jrmccluskey for label python.
Backup reviewer: shunping (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@jrmccluskey jrmccluskey 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.

LGTM

@jrmccluskey
jrmccluskey merged commit 313c54d into apache:master Oct 23, 2026
91 of 92 checks passed
@derrickaw
derrickaw deleted the 20261023_fixBQTools branch October 23, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants