Skip to content

Implement asyncio.Runner context manager #91218

Closed

Description

@asvetlov
BPO 47062
Nosy @asvetlov, @zware, @1st1, @kumaraditya303
PRs
  • bpo-47062: Implement asyncio.Runner context manager #31799
  • bpo-47062: Rename factory argument to loop_factory #32113
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-03-24.19:51:47.800>
    created_at = <Date 2022-03-18.20:44:42.359>
    labels = ['3.11', 'expert-asyncio']
    title = 'Implement asyncio.Runner context manager'
    updated_at = <Date 2022-03-25.22:26:35.045>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2022-03-25.22:26:35.045>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-03-24.19:51:47.800>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2022-03-18.20:44:42.359>
    creator = 'asvetlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47062
    keywords = ['patch']
    message_count = 5.0
    messages = ['415527', '415971', '415990', '416016', '416021']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'zach.ware', 'yselivanov', 'kumaraditya']
    pr_nums = ['31799', '32113']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue47062'
    versions = ['Python 3.11']

    Activity

    1. asvetlov commented on Mar 18, 2022

      @asvetlov
      ContributorAuthor

      Sometimes asyncio.run() is not enough.

      For example, unittest test case needs to call several async functions (setup, test, teardown) from the synchronous code using the same execution context and event loop.

      The proposal provides the following:

      with Runner() as runner:
        runner.run(async_func())
    2. asvetlov commented on Mar 24, 2022

      @asvetlov
      ContributorAuthor

      New changeset 4119d2d by Andrew Svetlov in branch 'main':
      bpo-47062: Implement asyncio.Runner context manager (GH-31799)
      4119d2d

    3. kumaraditya303 commented on Mar 25, 2022

      @kumaraditya303
      Contributor

      With this change, Github Actions fails first time and it passes in the second rerun of running asyncio tests.

      See https://github.com/python/cpython/runs/5682275663?check_suite_focus=true and main branch.

    4. asvetlov commented on Mar 25, 2022

      @asvetlov
      ContributorAuthor

      I believe the error is fixed by bpo-47118

    5. asvetlov commented on Mar 25, 2022

      @asvetlov
      ContributorAuthor

      New changeset bad6ffa by Andrew Svetlov in branch 'main':
      bpo-47062: Rename factory argument to loop_factory (GH-32113)
      bad6ffa

    6. transferred this issue fromon Apr 10, 2022
    7. encukou commented on Jun 2, 2022

      @encukou
      Member

      It seems that this commit broke tests in aiohttp: aio-libs/aiohttp#6757 (comment)

    8. graingert commented on Jun 22, 2022

      @graingert
      Contributor

      @encukou I have an issue here #93896 and a PR here #94058

    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

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions