Deprecate closing of existing loops #510
Merged
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()