Skip to content

chore(deps): update dependency pytest-asyncio to v1 #13389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate-bot
Copy link
Contributor

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
pytest-asyncio (changelog) ==0.23.6 -> ==1.0.0 age adoption passing confidence
pytest-asyncio (changelog) ==0.25.3 -> ==1.0.0 age adoption passing confidence
pytest-asyncio (changelog) ==0.16.0 -> ==1.0.0 age adoption passing confidence
pytest-asyncio (changelog) ==0.21.0 -> ==1.0.0 age adoption passing confidence
pytest-asyncio (changelog) ==0.21.1 -> ==1.0.0 age adoption passing confidence
pytest-asyncio (changelog) ==0.24.0 -> ==1.0.0 age adoption passing confidence

Release Notes

pytest-dev/pytest-asyncio (pytest-asyncio)

v1.0.0

Compare Source

v0.26.0: pytest-asyncio 0.26.0

Compare Source

  • Adds configuration option that sets default event loop scope for all tests #​793
  • Improved type annotations for pytest_asyncio.fixture #​1045
  • Added typing-extensions as additional dependency for Python <3.10 #​1045

v0.25.3: pytest-asyncio 0.25.3

Compare Source

  • Avoid errors in cleanup of async generators when event loop is already closed #​1040

v0.25.2: pytest-asyncio 0.25.2

Compare Source

  • Call loop.shutdown_asyncgens() before closing the event loop to ensure async generators are closed in the same manner as asyncio.run does #​1034

v0.25.1: pytest-asyncio 0.25.1

Compare Source

  • Fixes an issue that caused a broken event loop when a function-scoped test was executed in between two tests with wider loop scope #​950
  • Improves test collection speed in auto mode #​1020
  • Corrects the warning that is emitted upon redefining the event_loop fixture

v0.25.0: pytest-asyncio 0.25.0

Compare Source

0.25.0 (2024-12-13)

  • Deprecated: Added warning when asyncio test requests async @pytest.fixture in strict mode. This will become an error in a future version of flake8-asyncio. #​979
  • Updates the error message about pytest.mark.asyncio's scope keyword argument to say loop_scope instead. #​1004
  • Verbose log displays correct parameter name: asyncio_default_fixture_loop_scope #​990
  • Propagates contextvars set in async fixtures to other fixtures and tests on Python 3.11 and above. #​1008

v0.24.0: pytest-asyncio 0.24.0

Compare Source

0.24.0 (2024-08-22)

  • BREAKING: Updated minimum supported pytest version to v8.2.0
  • Adds an optional loop_scope keyword argument to pytest.mark.asyncio. This argument controls which event loop is used to run the marked async test. #​706, #​871
  • Deprecates the optional scope keyword argument to pytest.mark.asyncio for API consistency with pytest_asyncio.fixture. Users are encouraged to use the loop_scope keyword argument, which does exactly the same.
  • Raises an error when passing scope or loop_scope as a positional argument to @pytest.mark.asyncio. #​812
  • Fixes a bug that caused module-scoped async fixtures to fail when reused in other modules #​862 #​668

v0.23.8: pytest-asyncio 0.23.8

Compare Source

0.23.8 (2024-07-17)

  • Fixes a bug that caused duplicate markers in async tests #​813

Known issues

As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see #​706). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.

v0.23.7: pytest-asyncio 0.23.7

Compare Source

0.23.7 (2024-05-19)

  • Silence deprecation warnings about unclosed event loops that occurred with certain CPython patch releases #​817

Known issues

As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see #​706). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Never, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate-bot renovate-bot requested review from a team as code owners May 26, 2025 05:19
@trusted-contributions-gcf trusted-contributions-gcf bot added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels May 26, 2025
@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: firestore Issues related to the Firestore API. api: notebooks Issues related to the Vertex AI Workbench API. labels May 26, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 26, 2025
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.

Hello @renovate-bot, 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!

Summary of Changes

Hello team, gemini-code-assist here to provide a summary of this pull request. This PR, authored by renovate-bot, focuses on updating the pytest-asyncio dependency across various test requirement files within the repository. The update targets version 1.0.0, which is a major version bump from the previously pinned versions (ranging from 0.16.0 to 0.25.3). This upgrade is a standard dependency maintenance task to ensure we are using the latest stable version of the library, incorporating its newest features, bug fixes, and performance improvements. Reviewers should pay attention to potential breaking changes introduced in the 1.0.0 release of pytest-asyncio and verify that our test suites remain compatible.

Highlights

  • Dependency Update: The primary change is the upgrade of the pytest-asyncio library to version 1.0.0 in multiple requirements-test.txt files.
  • Major Version Bump: This is a major version update for pytest-asyncio, indicating potentially significant changes or breaking API modifications compared to the previous 0.x versions used.
  • Widespread Impact: The update affects test dependencies in several different sample directories, including alloydb, dialogflow-cx, firestore, genai, generative_ai, and model_garden.

Changelog

Click here to see the changelog
  • alloydb/notebooks/requirements-test.txt
    • Updated pytest-asyncio from 0.24.0 to 1.0.0.
  • dialogflow-cx/requirements-test.txt
    • Updated pytest-asyncio from 0.21.1 to 1.0.0.
  • firestore/cloud-async-client/requirements-test.txt
    • Updated pytest-asyncio from 0.21.0 (for Python > 3.6) and 0.16.0 (for Python < 3.7) to 1.0.0.
  • genai/controlled_generation/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • genai/count_tokens/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • genai/live/requirements-test.txt
    • Updated pytest-asyncio from 0.25.3 to 1.0.0.
  • genai/model_optimizer/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • genai/template_folder/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • genai/thinking/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • genai/tools/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/chat_completions/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/embeddings/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/evaluation/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/extensions/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/function_calling/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/image_generation/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/model_garden/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/model_tuning/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/prompts/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/provisioned_throughput/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/rag/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • generative_ai/reasoning_engine/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
  • model_garden/gemma/requirements-test.txt
    • Updated pytest-asyncio from 0.23.6 to 1.0.0.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Async tests run fast,
Pytest helps them all pass,
New version is here.

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 updates pytest-asyncio to v1.0.0 across multiple requirements-test.txt files. This is a significant major version upgrade from 0.x series, which can introduce breaking changes.

While many of the updates are from v0.23.x or v0.25.x and might be lower risk (especially where async tests are not heavily used), a few files are jumping from v0.21.x, which requires more careful consideration due to historical known issues with pytest-asyncio versions post-0.21.x concerning event loop and fixture scopes.

One critical issue has been identified regarding Python version compatibility for pytest-asyncio 1.0.0 in firestore/cloud-async-client/requirements-test.txt.

It's crucial that all corresponding test suites pass in CI environments after these updates. Please pay special attention to the test results for dialogflow-cx and firestore/cloud-async-client.

Summary of Findings

  • Python Version Incompatibility: In firestore/cloud-async-client/requirements-test.txt, the Python version markers for pytest-asyncio==1.0.0 are incorrect, as this version requires Python 3.8+. This is a critical issue that could lead to installation failures.
  • Risk of Breaking Changes from Large Version Jump: For dialogflow-cx/requirements-test.txt and firestore/cloud-async-client/requirements-test.txt, the update from pytest-asyncio v0.21.x to v1.0.0 is a large leap. Past versions between these releases had known issues that could break test suites. Thorough testing is essential to ensure compatibility.
  • Dependency Update Verification: This PR updates pytest-asyncio to a new major version (1.0.0). It's important to ensure all tests pass in CI across all affected samples to confirm compatibility and catch any regressions introduced by this update.

Merge Readiness

This pull request updates pytest-asyncio to v1.0.0. There is a critical issue in firestore/cloud-async-client/requirements-test.txt concerning Python version compatibility that must be addressed. Additionally, there are high-risk updates for dialogflow-cx and firestore/cloud-async-client due to the significant version jump from 0.21.x, which had different behavior regarding asyncio event loops and fixtures compared to later versions.

I recommend that the identified critical issue be fixed and that the high-risk updates be carefully validated through CI testing before this PR is merged. As I am an AI, I am not authorized to approve pull requests; please ensure this PR is reviewed and approved by a human maintainer after addressing the feedback.

Comment on lines +2 to +3
pytest-asyncio==1.0.0; python_version > '3.6'
pytest-asyncio==1.0.0; python_version < '3.7'
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The updated pytest-asyncio==1.0.0 requires Python 3.8 or newer. The current version markers seem to be a carry-over from older pytest-asyncio versions and are now incompatible or misleading.

Specifically:

  1. pytest-asyncio==1.0.0; python_version > '3.6': This would attempt to install pytest-asyncio 1.0.0 on Python 3.7, where it's not supported.
  2. pytest-asyncio==1.0.0; python_version < '3.7': This line attempts to install pytest-asyncio 1.0.0 on Python versions older than 3.7 (e.g., 3.6), where it's also not supported. This will likely lead to installation errors in such environments.

Given that pytest==8.2.0 (also in this file) requires Python 3.8+, it's likely that Python versions older than 3.8 are no longer targeted for these tests.

Could we update these lines to accurately reflect the Python version compatibility of pytest-asyncio==1.0.0? A single line specifying python_version >= '3.8' would be appropriate.

pytest-asyncio==1.0.0; python_version >= '3.8'

pytest-asyncio==1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This is a significant jump from pytest-asyncio==0.21.1 to 1.0.0. Versions of pytest-asyncio after 0.21.x (specifically around 0.23.x) had known issues regarding changes in event loop and fixture scope management that could break test suites previously working with 0.21.x. The release notes for v0.23.7 and v0.23.8 (included in this PR's description) explicitly warned about this and recommended staying on v0.21 if affected.

While these specific warnings are not present in the release notes for v0.25.0 onwards, indicating the issue might be resolved or mitigated, the large version leap warrants careful testing.

Could you please ensure that the tests in dialogflow-cx/, particularly streaming_detect_intent_infinite_test.py which uses @pytest.mark.asyncio, are thoroughly checked and pass with this new version? This is important to confirm that the test suite is not affected by the past behavior changes.

@@ -1,4 +1,4 @@
pytest==8.2.0
pytest-asyncio==0.21.0; python_version > '3.6'
pytest-asyncio==0.16.0; python_version < '3.7'
pytest-asyncio==1.0.0; python_version > '3.6'
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the concern raised for dialogflow-cx, this update involves a significant jump from pytest-asyncio==0.21.0 to 1.0.0 (for Python > 3.6).

As mentioned, pytest-asyncio versions post-0.21.x (around 0.23.x) introduced changes to event loop and fixture scope handling that could potentially break existing test suites. The firestore/cloud-async-client/ directory contains extensive use of async tests (snippets_test.py, distributed_counters_test.py).

Given the substantial changes between 0.21.0 and 1.0.0, it's crucial to verify that these tests continue to function correctly. Please ensure thorough CI validation for this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. api: notebooks Issues related to the Vertex AI Workbench API. owlbot:run Add this label to trigger the Owlbot post processor. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants