Repository navigation
Fix Python unit tests broken by google-api-core arriving via cloud-sql-python-connector 1.23.0 - #40623
Fix Python unit tests broken by google-api-core arriving via cloud-sql-python-connector 1.23.0#40623shunping wants to merge 5 commits into
Conversation
|
cc'ed @Amar3tto |
There was a problem hiding this comment.
📋 Review Summary
This PR updates the test skip guard for ReadGbqTransformTests and ReadUsingReadGbqTests from google.api_core.exceptions.GoogleAPICallError to apitools.base.py.exceptions.HttpError. This accurately reflects the actual dependency on google-apitools for the BigQuery client and resolves test failures in non-GCP environments where google-api-core is now transitively installed.
🔍 General Feedback
- The root cause analysis is clear and accurate.
- Aligning the skip condition with
io/gcp/bigquery_test.pyand removing the redundantTableFieldSchemacheck is clean and appropriate.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
requestresponse_it_test.py used to be skipped in non-GCP envs only because google-api-core was missing. Now that it comes in through cloud-sql-python-connector 1.23.0, the tests run on macOS and Windows runners, which have no Docker daemon.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40623 +/- ##
=============================================
+ Coverage 56.16% 79.92% +23.75%
=============================================
Files 1124 488 -636
Lines 178336 82550 -95786
Branches 1489 0 -1489
=============================================
- Hits 100170 65978 -34192
+ Misses 75645 16572 -59073
+ Partials 2521 0 -2521
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:
|
Summary
cloud-sql-python-connector1.23.0 was released on 2026-10-15 and is pulled in by thetestextra. It adds a new dependency ongoogle-cloud-sql, which requiresgoogle-api-core. As a result,google-api-coreis now installed in the non-GCPpy3xxtox environments, butgoogle-apitoolsis not.Some tests treated "
google.api_coreimports" as meaning "GCP dependencies are installed", or were skipped only because it failed to import. Those tests now run in environments that can't support them. Python Unit Tests on master has been failing on macOS and Windows since this release.Failure 1:
dataframe/io_test.pyReadGbqTransformTests.test_bad_schema_public_api_direct_readfails withValueError: Please install GCP Dependencies.ReadGbqTransformTests.test_unsupported_callable: the expected "got a callable instead" error never appears. Instead it raisesTypeError: isinstance() arg 2 must be a type, a tuple of types, or a union.google.api_corewas missing. Now that we havegoogle.api_core, but we are still missing the apitools-based BigQuery client in the environment.Failed workflows and examples:
Failure 2:
io/requestresponse_it_test.pyandtransforms/enrichment_handlers/cloudsql_it_test.pyTestRedisCache.test_rrio_no_coder_exceptionfails withdocker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')).TestExternalSQLServerEnrichmentfails with the same reason.ImportError, andapache_beam/io/requestresponse.pyunconditionally importsgoogle.api_core.exceptions. Before this release, that import failure was the only thing that skipped the module in non-GCP envs. Now the module loads,TestRedisCacheruns, and its Redis testcontainer can't start on runners without a Docker daemon, such as GitHub's macOS runners. It also doesn't work on GitHub's windows runners, because windows runners have a Docker daemon but they only run Windows containers.Failed workflows and examples: