Skip to content

Conversation

@parthea
Copy link
Contributor

@parthea parthea commented Jan 22, 2026

This PR resolves the following failure which appears in

==================================== ERRORS ====================================
________________ ERROR collecting tests/unit/test_reader_v1.py _________________
ImportError while importing test module '/tmpfs/src/github/google-cloud-python/packages/google-cloud-bigquery-storage/tests/unit/test_reader_v1.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.14/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/unit/test_reader_v1.py:31: in 
    from .helpers import SCALAR_BLOCKS, SCALAR_COLUMN_NAMES, SCALAR_COLUMNS
tests/unit/helpers.py:20: in 
    import pytz
E   ModuleNotFoundError: No module named 'pytz'
_____________ ERROR collecting tests/unit/test_reader_v1_arrow.py ______________
ImportError while importing test module '/tmpfs/src/github/google-cloud-python/packages/google-cloud-bigquery-storage/tests/unit/test_reader_v1_arrow.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.14/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/unit/test_reader_v1_arrow.py:33: in 
    from .helpers import SCALAR_BLOCKS, SCALAR_COLUMN_NAMES, SCALAR_COLUMNS
tests/unit/helpers.py:20: in 
    import pytz
E   ModuleNotFoundError: No module named 'pytz'

pytz was used in tests but not explicitly installed. This PR removes usage of pytz in tests, although it is still needed transitively via pandas

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @parthea, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the test suite for the google-cloud-bigquery-storage library to eliminate direct reliance on the pytz library for timezone handling. Instead, it leverages the built-in datetime.timezone.utc for defining UTC timezones in tests. This change modernizes the codebase by utilizing standard library features and streamlines test dependencies, while ensuring pytz remains available as an indirect dependency for pandas where required.

Highlights

  • Test Modernization: The direct usage of the pytz library for timezone handling in system and unit tests has been removed, opting instead for the standard library's datetime.timezone.utc.
  • Dependency Management: Unnecessary test dependencies cachetools and cryptography were removed from noxfile.py. pytz was explicitly added as a dependency in generator-input and constraints-3.7.txt to ensure pandas functionality, which may rely on pytz.
  • Metadata Update: The last_generated_commit for google-cloud-bigquery-storage in .librarian/state.yaml was updated, likely reflecting a regeneration of client library configurations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 effectively removes the direct dependency on pytz in the test suite by migrating to the standard library's datetime.timezone.utc. This is a great improvement for modernizing the codebase. I've added a few suggestions regarding dependency management best practices: pinning the version of the newly added pytz dependency for reproducibility, and keeping pull requests focused on a single concern. Overall, the changes are in a good direction.

libcst==0.2.5
fastavro==0.21.2
# pytz is required by pandas
pytz
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To ensure reproducible builds, it's a good practice to pin dependency versions. Please specify a version for pytz. For example, pytz==2023.3.

      pytz==2023.3

PACKAGE_NAME = "google-cloud-bigquery-storage"

UNIT_TEST_STANDARD_DEPENDENCIES = [
"cachetools",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This dependency removal is out of scope for this PR, which focuses on pytz. To maintain a clean and atomic commit history, it's best to handle unrelated changes in separate pull requests.

SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = []
SYSTEM_TEST_DEPENDENCIES: List[str] = []
SYSTEM_TEST_EXTRAS: List[str] = [
"cryptography",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the cachetools removal, this change is out of scope for this PR. Please group related changes into a single PR and keep unrelated changes separate for better reviewability and a cleaner commit history.

libcst==0.2.5
fastavro==0.21.2
# pytz is required by pandas
pytz
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For reproducible test runs, it's a good practice to pin all dependencies in a constraints file. Please add a specific version for pytz. For example, pytz==2023.3.

pytz==2023.3

@parthea parthea marked this pull request as ready for review January 22, 2026 18:18
@parthea parthea requested review from a team as code owners January 22, 2026 18:18
@parthea parthea requested a review from logachev January 22, 2026 18:18
@Linchin Linchin merged commit d6af4ab into main Jan 22, 2026
26 checks passed
@Linchin Linchin deleted the re-generate-bq-storage branch January 22, 2026 18:20
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.

2 participants