GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(auth): Fix test coverage for mtls_helper by andyrzhao · Pull Request #1886 · googleapis/google-auth-library-python

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@andyrzhao

@andyrzhao andyrzhao commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Uses the conventional mock.patch decorators instead of monkeypatch to satisfy the coverage analyzer. This brings coverage from 99% to 100%

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@andyrzhao
fix(auth): Fix test coverage for mtls_helper
fa70b04
@andyrzhao
andyrzhao requested review from a team December 12, 2025 20:01
@gemini-code-assist

gemini-code-assist Bot commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @andyrzhao, 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 enhancing the test suite for the mtls_helper module by migrating from monkeypatch to mock.patch decorators. This strategic refactoring ensures that the test coverage analyzer can accurately report 100% coverage for the module, improving the reliability and maintainability of the authentication-related utilities.

Highlights

  • Test Refactoring: The tests for _mtls_helper.check_use_client_cert have been refactored to replace monkeypatch with mock.patch decorators for environment variable and file system mocking.
  • Coverage Improvement: This change specifically addresses test coverage analysis, bringing the coverage for the mtls_helper module from 99% to 100% by using conventional mocking techniques that are better recognized by coverage tools.
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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daniel-sanche
daniel-sanche previously approved these changes Dec 12, 2025
View reviewed changes
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Dec 12, 2025
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 refactors the tests for _mtls_helper.check_use_client_cert to use mock.patch decorators instead of monkeypatch, which resolves a coverage analysis issue and improves test structure. The changes are well-implemented and the new tests are more organized and comprehensive. I've suggested adding a couple more test cases to cover additional error scenarios (TypeError and OSError) to make the test suite even more robust.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/transport/test__mtls_helper.py

@mock.patch.dict(os.environ, {}, clear=True)
def test_no_env_vars_set(self):
assert _mtls_helper.check_use_client_cert() is False

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daniel-sanche
daniel-sanche enabled auto-merge (squash) December 12, 2025 20:22
@andyrzhao
fix(auth): Fix lint for mtls_helper remove unused import
4cc6ec0
@andyrzhao
andyrzhao dismissed daniel-sanche’s stale review via 4cc6ec0 December 13, 2025 05:50
@andyrzhao
andyrzhao requested a review from daniel-sanche December 13, 2025 06:38
daniel-sanche
daniel-sanche previously approved these changes Dec 15, 2025
View reviewed changes
@daniel-sanche
Merge branch 'main' into main
dfa813c
agrawalradhika-cell
agrawalradhika-cell previously approved these changes Dec 15, 2025
View reviewed changes
@andyrzhao
Merge branch 'main' into main
c8e16d5
@andyrzhao
andyrzhao dismissed stale reviews from agrawalradhika-cell and daniel-sanche via c8e16d5 December 15, 2025 20:39
@andyrzhao
fix(auth): spacing
8f088dd
@daniel-sanche daniel-sanche added the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 15, 2025
@andyrzhao
andyrzhao requested a review from daniel-sanche December 15, 2025 22:58
@daniel-sanche
Merge branch 'main' into main
eed1afd
daniel-sanche
daniel-sanche approved these changes Dec 15, 2025
View reviewed changes
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Dec 15, 2025
@daniel-sanche
daniel-sanche merged commit 02e7163 into googleapis:main Dec 15, 2025
@daniel-sanche daniel-sanche mentioned this pull request Jan 5, 2026
chore: librarian release pull request: 20260105T122553Z #1913
Merged
daniel-sanche added a commit that referenced this pull request Jan 5, 2026
@daniel-sanche
chore: librarian release pull request: 20260105T122553Z (#1913)
2cbc2a2
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v1.0.1
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
<details><summary>google-auth: 2.46.0</summary>

##
[2.46.0](v2.45.0...v2.46.0)
(2026-01-05)

### Features

* Recognize workload certificate config in
has_default_client_cert_source for mTLS for Agentic Identities (#1907)
([0b9107d](0b9107d5))

### Bug Fixes

* Fix test coverage for mtls_helper (#1886)
([02e7163](02e71631))

* use .read() instead of .content.read() in aiohttp transport (#1899)
([12f4470](12f4470f))

* add types to default and verify_token and Request __init__ based on
comments in the source code. (#1588)
([59a5f58](59a5f588))

* fix the document of secure_authorized_session (#1536)
([5d00147](5d001470))

* raise RefreshError for missing token in impersonated credentials
(#1897)
([94d04e0](94d04e09))

* remove setup.cfg configuration for creating universal wheels (#1693)
([c767531](c767531c))

### Documentation

* update urllib3 docstrings for v2 compatibility (#1903)
([3f1aeea](3f1aeea2))

</details>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@daniel-sanche daniel-sanche daniel-sanche approved these changes
@agrawalradhika-cell agrawalradhika-cell agrawalradhika-cell left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@andyrzhao @daniel-sanche @agrawalradhika-cell @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.