Deprecate closing of existing loops#510
Merged
seifertm merged 2 commits intoMar 19, 2023
Merged
Conversation
…et_event_loop. Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
…cationWarning. Changing the warning type emphasizes that the functionality will no longer be available in the future. The commit also extends the tests for the deprecation warning and adjusts the changlog entry and deprecation message. Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
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.
asyncio.get_event_loop()will effectively become an alias toasyncio.get_running_loop()in future Python versions. [0] As a result, pytest-asyncio will no longer be able to retrieve the current loop and close it for the user.This PR raises a deprecation warning when the event_loop fixture is torn down and the current loop is unclosed. This will hopefully nudge users towards correct event loop handling and prevent breakage of their tests when pytest-asyncio removes the use of get_event_loop().
I think the previous PR didn't go far enough with emitting a ResourceWarning, because ResourceWarnings are not displayed by default.
[0] Deprecate get_event_loop()