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
I want to be able to create utility subclasses of IsolatedAsyncioTestCase that use either uvloop or a specific event loop using the asyncio.Runner(..., loop_factory=...) kwarg, Ideally it would look something like:
Another advantage of setting loop_factory would allow use of IsolatedAsyncioTestCase without using def tearDownModule(): asyncio.set_event_loop_policy(None) because asyncio.Runner does not call asyncio.get_event_loop_policy() when called with a loop_factory
classDefaultIsolatedAsyncioTestCase:
""" Use the most efficient event loop regardless of what has been configured with asyncio.set_event_loop_policy does not require `def tearDownModule(): asyncio.set_event_loop_policy(None)` """loop_factory=asyncio.EventLoop
or
classUvloopIsolatedAsyncioTestCase:
""" runs tests on uvloop """loop_factory=uvloop.new_event_loop
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Proposal:
I want to be able to create utility subclasses of
IsolatedAsyncioTestCase
that use either uvloop or a specific event loop using theasyncio.Runner(..., loop_factory=...)
kwarg, Ideally it would look something like:Another advantage of setting
loop_factory
would allow use ofIsolatedAsyncioTestCase
without usingdef tearDownModule(): asyncio.set_event_loop_policy(None)
becauseasyncio.Runner
does not callasyncio.get_event_loop_policy()
when called with aloop_factory
or
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/support-setting-the-loop-factory-in-isolatedasynciotestcase/36027
Linked PRs
The text was updated successfully, but these errors were encountered: