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

Use of asyncio.get_event_loop_policy deprecated in Python 3.14-dev #1025

Open
scop opened this issue Dec 29, 2024 · 1 comment
Open

Use of asyncio.get_event_loop_policy deprecated in Python 3.14-dev #1025

scop opened this issue Dec 29, 2024 · 1 comment
Milestone

Comments

@scop
Copy link

scop commented Dec 29, 2024

Running 0.25.0 with current Python 3.14-dev yields

DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16

Similarly asyncio.set_event_loop_policy.

@seifertm
Copy link
Contributor

Thanks for bringing this to attention!

The asyncio policy deprecation has been coming for quite some time. It's clear that we need to tackle this in pytest-asyncio as well. The preferred way to address the deprecation is to refactor the pytest-asyncio code base accordingly. I'm not sure this is easily possible, though.

Alternatively, we can take a similar approach as for the deprecation of asyncio.get_event_loop. That means refactoring pytest-asyncio to centralize calls to (g|s)et_event_loop_policy into a single function and ignore the warning in that function. That way, the warning doesn't bubble up to user code. We can get away with this for another two Python releases until the warning becomes an error. Hopefully, it doesn't take that long to fully adjust the code base :)

We don't currently test against development versions of Python. Therefore, I don't see the priority of addressing this issue as particularly high.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants