Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support setting the loop_factory in IsolatedAsyncioTestCase #110774

Closed
Labels
@graingert

Description

@graingert

Proposal:

I want to be able to create utility subclasses ofIsolatedAsyncioTestCase that use either uvloop or a specific event loop using theasyncio.Runner(..., loop_factory=...) kwarg, Ideally it would look something like:

Another advantage of settingloop_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

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

Links to previous discussion of this feature:

https://discuss.python.org/t/support-setting-the-loop-factory-in-isolatedasynciotestcase/36027

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp