Open tuukkamustonen opened 1 month ago
https://pytest-asyncio.readthedocs.io/en/latest/reference/fixtures/index.html#event-loop suggests that it's fine to grab event_loop fixture in a non-async function.
event_loop
0.21+ migration guide in https://pytest-asyncio.readthedocs.io/en/latest/how-to-guides/migrate_from_0_21.html suggests to convert all sync functions requesting the event_loop fixture into async functions, and then acquire the loop via asyncio.get_running_loop().
asyncio.get_running_loop()
Which one is it, and what is the rationale of not depending on the event_loop fixture directly?
The use of _eventloop is deprecated. We should adjust the docs to reflect that. The rationale is summarized here: https://github.com/pytest-dev/pytest-asyncio/issues/706#issuecomment-2282780197
https://pytest-asyncio.readthedocs.io/en/latest/reference/fixtures/index.html#event-loop suggests that it's fine to grab
event_loop
fixture in a non-async function.0.21+ migration guide in https://pytest-asyncio.readthedocs.io/en/latest/how-to-guides/migrate_from_0_21.html suggests to convert all sync functions requesting the
event_loop
fixture into async functions, and then acquire the loop viaasyncio.get_running_loop()
.Which one is it, and what is the rationale of not depending on the
event_loop
fixture directly?