Docs: update uvloop how-to to avoid deprecated EventLoopPolicy#1355
Docs: update uvloop how-to to avoid deprecated EventLoopPolicy#1355veeceey wants to merge 2 commits intopytest-dev:mainfrom
Conversation
uvloop.EventLoopPolicy was deprecated in uvloop 0.21 and will be removed in Python 3.16. Replace the documented pattern with a minimal custom policy subclass that delegates to uvloop.new_event_loop(), and add a note about the deprecation context and future plans. Closes pytest-dev#1346 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1355 +/- ##
=======================================
Coverage 93.64% 93.64%
=======================================
Files 2 2
Lines 409 409
Branches 44 44
=======================================
Hits 383 383
Misses 20 20
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi maintainers, friendly ping on this PR. It's been open for about 10 days. All checks are passing and codecov shows full coverage. Would appreciate a review when you get a chance. Thank you! |
|
Hi @veeceey ! Thanks for the initiative and the ping. I can see how the warning is annoying. The underlying issue is that the asyncio policy system has been deprecated in Python. This PR doesn't address the root cause (i.e. pytest-asyncio not having a non-deprecated replacement for configuring asyncio loops), but instead works around the issue. The proposed solution adds an additonal layer of indirection, but is functionally the same as a warning filter. Therefore, I'm -1 on the patch. |
Summary
uvloop.EventLoopPolicy()pattern indocs/how-to-guides/uvloop.rstwith a minimal custom policy subclass that delegates touvloop.new_event_loop().. note::block explaining the deprecation context (uvloop#637, Python 3.14 policy deprecation) and linking to#1164for the planned non-policy-based replacementmultiple_loops_example.pyand the fixtures reference examplesCloses #1346
Test plan
conftest.pyand running an async test