GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support setting the loop_factory in IsolatedAsyncioTestCase · Issue #110774 · python/cpython

Support setting the loop_factory in IsolatedAsyncioTestCase #110774

New issue
Copy link
New issue
Copy link
Closed
Closed
Support setting the loop_factory in IsolatedAsyncioTestCase#110774
Copy link
Labels
topic-asynciotype-featureA feature request or enhancementA feature request or enhancement

Description

@graingert
graingert
opened on Oct 12, 2023
Issue body actions

Proposal:

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

class DefaultIsolatedAsyncioTestCase:
    """
    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

class UvloopIsolatedAsyncioTestCase:
    """
    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

  • gh-110774: allow setting the Runner(loop_factory=...) from IsolatedAsyncioTestCase #110776
Reacted by Guido van Rossum

Activity

  1. graingert
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Oct 12, 2023
  2. AlexWaygood
    added
    topic-asyncio
    on Oct 12, 2023
  3. github-project-automation
    added this to asyncioon Oct 12, 2023
  4. github-project-automation
    moved this to Todo in asyncioon Oct 12, 2023
  5. gvanrossum
    added a commit that references this issue on Oct 31, 2023

    gh-110774: allow setting the Runner(loop_factory=...) from IsolatedAs…

    7705306
  6. gvanrossum
    closed this as completedon Oct 31, 2023
  7. github-project-automation
    moved this from Todo to Done in asyncioon Oct 31, 2023
  8. FullteaR
    added a commit that references this issue on Nov 3, 2023

    pythongh-110774: allow setting the Runner(loop_factory=...) from Isol…

    3512380
  9. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-110774: allow setting the Runner(loop_factory=...) from Isol…

    73dc956
  10. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-110774: allow setting the Runner(loop_factory=...) from Isol…

    47d7b80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-asynciotype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • asyncio
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.