Skip to content
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

[fix] Prevent DeprecationWarning about existing event loops to bubble up into user code #461

Conversation

seifertm
Copy link
Contributor

@seifertm seifertm commented Dec 8, 2022

Pytest-asyncio fixture setup currently uses get_event_loop to clean up loops that don't correspond to the loop returned by the event_loop fixture. Starting with CPython 3.10.9 and 3.11.1 the call to get_event_loop emits a DeprecationWarning when function is called, but no event loop exists. This warning bubbles up and shows in test runs of library users. If the users have enabled -W error their tests will fail due to a warning in pytest-asyncio.

This patch ignores the DeprecationWarning in the fixture setup. This is a temporary solution to restore compatibility with the respective CPython patch releases.

Addresses #460

… up into user code.

Pytest-asyncio fixture setup currently uses `get_event_loop` to clean up loops that don't correspond to the loop returned by the `event_loop` fixture. Starting with CPython 3.10.9 and 3.11.1 the call to get_event_loop emits a DeprecationWarning when function is called, but no event loop exists. This warning bubbles up and shows in test runs of library users. If the users have enabled `-W error` their tests will fail due to a warning in pytest-asyncio.

This patch ignores the DeprecationWarning in the fixture setup. This is a temporary solution to restore compatibility with the respective CPython patch releases.

Addresses pytest-dev#460

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@seifertm seifertm merged commit 007e8ec into pytest-dev:master Dec 8, 2022
@seifertm seifertm deleted the suppress-get-event-loop-deprecation-warning branch October 23, 2023 06:16
@seifertm seifertm restored the suppress-get-event-loop-deprecation-warning branch October 23, 2023 08:17
@seifertm seifertm deleted the suppress-get-event-loop-deprecation-warning branch October 23, 2023 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants