-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix wrong event loop reference with mixed scoped tests #1029
Fix wrong event loop reference with mixed scoped tests #1029
Conversation
…two wider-scoped tests. The event_loop fixture finalizers only close event loops that were not created by pytest-asyncio. This prevents the finalizers from accidentally closing a module-scoped loop, for example.
…the more generic "__pytest_asyncio" magic attribute.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1029 +/- ##
==========================================
- Coverage 91.42% 91.10% -0.33%
==========================================
Files 2 2
Lines 548 562 +14
Branches 72 74 +2
==========================================
+ Hits 501 512 +11
- Misses 28 30 +2
- Partials 19 20 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
The code is extremely complex now; I have no idea how to simplify it and keep backward compatibility, though.
Thanks for having a look! I agree that the code is really complex. It takes hours to debug even simple changes and understand We really made an effort to keep backwards compatibility, so that made the situation worse. Maybe we should start following through with all the deprecations that were introduced and start cleaning up the code. |
Issue #950 describes a problem with tests that have mixed event loop scopes. When a function-scoped loop is executed in between two tests with wider loop scope, the tests after the function-scoped tests reference the wrong event loop.
This is caused by the implementation of the event_loop fixture and its finalizers. This PR addresses the issue twofold:
Fixes #950