fix: resolve CI failures, drop Python 3.9, and clean up test deprecations#1504
fix: resolve CI failures, drop Python 3.9, and clean up test deprecations#1504aseering wants to merge 15 commits intogoogleapis:mainfrom
Conversation
Prevents swallowing exceptions and fixes SyntaxWarning in Python 3.14.
- Replaces deprecated datetime.utcnow() with timezone-aware datetime.now(timezone.utc). - Renames MockCredentials and MockClass to avoid pytest/unittest collection warnings.
Silently drops metrics missing instance_id to prevent 400 InvalidArgument errors from Cloud Monitoring for project-level operations.
Summary of ChangesHello, 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 significantly enhances the stability and maintainability of the codebase by addressing critical CI failures and cleaning up test output. It resolves a metrics exporter crash, removes support for an outdated Python version, fixes a SyntaxWarning, and updates deprecated datetime usage and pytest class naming conventions. The overall impact is a more robust and less noisy development and testing environment. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a set of valuable changes that address CI failures, remove support for Python 3.9, and clean up various deprecation warnings in the test suite. The fix for the Spanner Metrics Exporter crash, by ensuring project_id is present and filtering out metrics lacking an instance_id, is well-implemented and correctly addresses the underlying issue. The codebase is also improved by replacing deprecated datetime.utcnow() calls with the timezone-aware datetime.now(timezone.utc) and resolving a SyntaxWarning in cursor.py. The test suite is made more robust by renaming helper classes to avoid pytest warnings. Overall, the changes are correct and improve the health and reliability of the codebase.
- Fix missing imports in metrics_exporter.py - Fix shadow datetime import in test_pool.py - Fix exception handling in cursor.py that broke dbapi tests
… to 3.14 - Fixes 'Python interpreter 3.10 not found' error in GitHub Actions lint job. - Fixes 'system' nox session failing because GitHub Actions only provisions Python 3.14 for it.
This PR addresses several underlying issues causing CI flakiness and hard failures, alongside general code health improvements to clean up the test
output.
Changes Made:
Fix Spanner Metrics Exporter Crash (fix)
which requires an instance_id. Missing labels caused 400 InvalidArgument errors, crashing the thread and failing the Nox session.
Drop Python 3.9 Support (build)
inputs), and GitHub Actions.
Fix
SyntaxWarningincursor.py(fix)Resolve Deprecation Warnings & Pytest Issues (chore)