Skip to content

Conversation

@daniel-sanche
Copy link
Collaborator

@daniel-sanche daniel-sanche commented Jan 6, 2026

Added back 3.7 unit tests, and fixed up test code to pass on 3.7

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @daniel-sanche, 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 focuses on restoring and enhancing compatibility with Python 3.7 and 3.8. It addresses the absence of unittest.mock.AsyncMock in Python versions prior to 3.8 by introducing conditional imports and adding the mock library as a dependency for older environments. The changes also re-enable unit tests for Python 3.7 and 3.8 in the Nox configuration and incorporate from __future__ import annotations in key modules to ensure better type hinting support across different Python versions.

Highlights

  • Python 3.7/3.8 Test Support: Re-enabled Python 3.7 and 3.8 for unit testing in the Nox configuration, removing previous TODO comments that temporarily disabled them.
  • AsyncMock Compatibility: Implemented conditional imports for AsyncMock in asynchronous test files, allowing it to be imported from unittest.mock for Python 3.8+ and falling back to the mock library for Python versions older than 3.8.
  • Conditional Dependency: Added mock as a conditional dependency in setup.py for Python versions less than 3.8, ensuring the availability of AsyncMock functionality in older environments.
  • Type Hinting Improvements: Included from __future__ import annotations in google/auth/_default.py and google/oauth2/id_token.py for improved type hint compatibility across Python versions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/unittest.yml
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 adds support for Python 3.7 by making several compatibility adjustments. The main changes include updating type hints for compatibility with Python versions older than 3.9, conditionally importing AsyncMock from the mock backport library for Python < 3.8, and updating the test configuration to include Python 3.7 and 3.8. The changes are well-implemented and correctly address the version compatibility issues. I have one suggestion regarding the noxfile.py configuration to ensure the new Python versions are included in the default test run.

noxfile.py Outdated
Comment on lines 47 to 48
@@ -44,8 +51,6 @@
"lint",
"blacken",
"mypy",
# TODO(https://github.com/googleapis/google-auth-library-python/issues/1787):
# Remove or restore testing for Python 3.7/3.8
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While the TODO comment is removed, the unit-3.7 and unit-3.8 sessions have not been added to the default nox.options.sessions list. To ensure these newly supported Python versions are tested by default when running nox, they should be added to this list.

@daniel-sanche daniel-sanche changed the title [DRAFT] fix: Python 3.7 support fix: Python 3.7 support Jan 6, 2026
@daniel-sanche daniel-sanche added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jan 6, 2026
@daniel-sanche
Copy link
Collaborator Author

Decided to remove 3.7 support instead: #1919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant