fix: replace deprecated asyncio.get_event_loop() with modern approach#1865
Merged
waketzheng merged 4 commits intotortoise:developfrom Feb 5, 2025
Merged
Conversation
Replace deprecated get_event_loop() with get_running_loop() and fallback to new_event_loop() to fix the "no current event loop" warning in Python 3.10+
CodSpeed Performance ReportMerging #1865 will not alter performanceComparing Summary
|
Pull Request Test Coverage Report for Build 13026698161Details
💛 - Coveralls |
waketzheng
requested changes
Jan 26, 2025
Contributor
waketzheng
left a comment
There was a problem hiding this comment.
Use 0.24.1 (unreleased) instead of 0.24.1
Contributor
|
@Abdeldjalil-H, can you please merge your changes with |
7b7e908 to
1232311
Compare
1232311 to
0a7fffd
Compare
henadzit
approved these changes
Jan 29, 2025
waketzheng
approved these changes
Feb 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace deprecated
get_event_loop()withget_running_loop()and fallback tonew_event_loop()to fix the "no current event loop" warning in Python 3.10+ #1824Description
This PR updates the event loop handling in the test suite by replacing the deprecated
asyncio.get_event_loop()with the modern approach usingget_running_loop()with a fallback tonew_event_loop(). The change specifically targets the code in/tortoise/contrib/test/__init__.py.Motivation and Context
Since Python 3.10, using
asyncio.get_event_loop()triggers a deprecation warning:DeprecationWarning: There is no current event loopThis change modernizes the code to use the recommended approach for handling event loops, eliminating the deprecation warning while maintaining functionality.
How Has This Been Tested?
Running tests
Checklist: