-
Notifications
You must be signed in to change notification settings - Fork 159
Python 3.10 compatibility #214
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
Merged
Tinche
merged 8 commits into
pytest-dev:master
from
seifertm:issue-212-python-3.10-compat
May 30, 2021
Merged
Python 3.10 compatibility #214
Tinche
merged 8 commits into
pytest-dev:master
from
seifertm:issue-212-python-3.10-compat
May 30, 2021
Conversation
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
…alization as in the plugin. The plugin code creates a new event loop from the current event loop policy, whereas the fixture in the Hypothesis test uses get_event_loop. In Python 3.10 the use of get_event_loop was deprecated and causes the Hypothesis tests to fail. Signed-off-by: Michael Seifert <[email protected]>
…has no effect. Under Python 3.10, the remove_loop fixture raises: "DeprecationWarning: There is no current event loop" This means that the remove_loop fixture effectively does nothing. The test case is still kept, because it seemingly aims to test that the "asyncio" marker works inside test classes when no "event_loop" fixture is explicitly specified. Signed-off-by: Michael Seifert <[email protected]>
…the asyncio marker in class-based tests. Rephrased test names and comments to make the test intention more clear. Signed-off-by: Michael Seifert <[email protected]>
08d6d77
to
8b8e5a9
Compare
Codecov Report
@@ Coverage Diff @@
## master #214 +/- ##
=======================================
Coverage 95.86% 95.86%
=======================================
Files 2 2
Lines 145 145
=======================================
Hits 139 139
Misses 6 6 Continue to review full report at Codecov.
|
…osed. Under Python 3.10, the tests raise: "DeprecationWarning: There is no current event loop" This means that the asyncio.get_event_loop does not return any existing loop. It creates a new loop as a side effect instead. Therefore, test_1 and test_3 will always be successful. However, it would be wrong to simply delete the tests without a replacement. Although, we cannot retrieve the default loop with get_event_loop, we can still retrieve it from the event loop policy. The new tests do exactly that and assert that the loop is a different object than in the tests before. Signed-off-by: Michael Seifert <[email protected]>
…ecationWarning on Python 3.10. The code was adjusted to use asyncio.get_event_loop_policy().get_event_loop() rather than the deprecated asyncio.get_event_loop(). Some additional comments were added to clarify the circumstances under which the test can fail. Signed-off-by: Michael Seifert <[email protected]>
Signed-off-by: Michael Seifert <[email protected]>
Signed-off-by: Michael Seifert <[email protected]>
Adjusted changelog and setup.py accordingly. Signed-off-by: Michael Seifert <[email protected]>
8b8e5a9
to
43685c8
Compare
Nice! This is very valuable work. Thank you. |
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.
Adjusted or reworked test suite to be compatible with Python 3.10.
Using
asyncio.get_event_loop()
with Python 3.10 results in a DeprecationWarning. Tests using the functionality were adjusted accordingly. Some test were slightly reworked based on the original test intentions of the respective authors. Please refer to the commit for the rationale behind the individual changes.Closes #212