You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Test case (test_async_fixtures_with_finalizer) refactoring to pass on python 3.6 & 3.5
2) An additional test case (test_module_with_get_event_loop_finalizer).
Refactoring previous test case I got to another potential issue: Finalizers using get_event_loop() instead of event_loop [on a module scope fixture]
To be able to pass this new test case I needed some additional changes on next event_loop fixture block( https://github.com/pytest-dev/pytest-asyncio/blob/v0.12.0/pytest_asyncio/plugin.py#L54-L66):
- This block needs to apply on all event_loop fixture scopes (so I remove 'asyncio' in request.keywords, that only apply to function scope)
- The get_event_loop() method inside this block has following side effects (See https://github.com/python/cpython/blob/3.8/Lib/asyncio/events.py#L636):
- As no loop is still set, then L636 is executed, and so a new event_loop (let's call it L2) is first created and then set.
- And then finalizer will restore L2 at the end of test. What has no sense, to restore L2 that wasn't before the test. And additionally this L2 is never closed.
So it seeems that get_event_loop() should be removed, and so I see no reasons for any finalizer.
3) DRY: New FixtureStripper to avoid repeating code
0 commit comments