Skip to content

Conversation

@ohmayr
Copy link
Contributor

@ohmayr ohmayr commented Nov 12, 2025

1. Deprecated credentials_file in google-auth:

The `credentials_file` argument was deprecated by the Google Cloud Auth library (`google-auth`), which is the upstream dependency responsible for handling authentication. The core reason for this deprecation is security.

The new best practice, which the `google-auth` library now promotes, is to use explicit, type-specific loaders.

The google-api-core library (where we are working) uses google-auth for its authentication, so it is passing this deprecation warning along to its users to encourage them to adopt the safer pattern.

This change updates the affected unit tests to explicitly handle these warnings using `pytest.warns()`. The warnings are an expected and correct behavior for deprecated functionality and for Python version support checks.

2. Future warnings are raised for Python 3.10:

FutureWarning: You are using a Python version (3.10.13) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-1...

We're suppressing these warnings in our unit tests but these will be correctly emitted to the user.

3. .nox/unit_w_prerelease_deps-3-14 failing:

The test `test_wrap_method_with_overriding_timeout_as_a_number()` was failing due to an AssertionError.

The purpose of this test is to verify that when a user provides a timeout number (e.g., 22), that number is correctly passed down to the underlying grpc call. It's a "plumbing" test, not a performance or precision timing test. We've adjusted the tolerance to fix this issue.

@ohmayr ohmayr requested review from a team as code owners November 12, 2025 09:16
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Nov 12, 2025
@parthea parthea changed the title Fix(tests): Handle deprecation warnings in unit tests tests: Handle deprecation warnings in unit tests Nov 12, 2025
credentials_file="credentials.json",
credentials=mock.sentinel.credentials,
)
with pytest.warns(DeprecationWarning):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a comment to clarify that credentials_file is deprecated. Applies throughout

noxfile.py Outdated
Comment on lines 193 to 196
# We use filterwarnings to ignore warnings that are out of our control,
# but we want to make sure that our own code does not generate warnings.
"-m",
"not filterwarnings",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We do want to see warnings as that may require code changes. We can filter warnings here with a comment that links to a bug with more information

filterwarnings = [

@parthea parthea assigned ohmayr and unassigned daniel-sanche Nov 12, 2025
@ohmayr ohmayr closed this Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants