test: add dual-environment validation tests for pandas-gbq delegation - #18018
test: add dual-environment validation tests for pandas-gbq delegation#18018shuoweil wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new test suite test_reader_pandas_gbq.py to verify Arrow serialization and deserialization behaviors, including delegation to pandas_gbq and fallback paths when it is not installed. The review feedback points out that importing pandas_gbq.arrow at the top level will cause test discovery to fail in environments where pandas-gbq is missing. It suggests dynamically importing the optional dependency using pytest.importorskip within the relevant tests to ensure robust test execution and proper path isolation.
| import decimal | ||
| from unittest import mock | ||
|
|
||
| import pandas_gbq.arrow |
There was a problem hiding this comment.
Importing pandas_gbq.arrow at the top level will cause the entire test module to fail to load in environments where pandas-gbq is not installed. Since this file contains tests specifically designed to verify the fallback behavior when pandas-gbq is not installed (e.g., test_read_rows_page_to_arrow_falls_back_when_pandas_gbq_uninstalled), we should avoid top-level imports of optional dependencies. Instead, import them dynamically within the specific tests that require them.
…pandas_gbq.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…pandas_gbq.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…pandas_gbq.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…pandas_gbq.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Adds end-to-end unit test validation for
ReadRowsPage.to_arrow()delegation topandas-gbqand fallback behavior whenpandas-gbqis uninstalled.Changes
packages/google-cloud-bigquery-storage/tests/unit/test_reader_pandas_gbq.pypandas-gbqis absent.Fixes #< 540939659 > 🦕