Skip to content

Mocking a MagicMock with a function spec results in an AsyncMock #81432

@jeremycline

Description

@jeremycline
BPO 37251
Nosy @lisroach, @hroncok, @mariocj89, @miss-islington, @tirkarthi, @jeremycline, @msuozzo
PRs
  • bpo-37251: MagicMock with function spec used as a spec in mock.patch should return a MagicMock #14117
  • bpo-37251: Removes __code__ check from _is_async_obj. #15830
  • [3.8] bpo-37251: Removes __code__ check from _is_async_obj. (GH-15830) #15837
  • gh-81432: Make create_autospec generate AsyncMocks for awaitable classes #25347
  • 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 = None
    created_at = <Date 2019-06-12.14:00:18.556>
    labels = ['3.8', 'type-bug', 'library', '3.9']
    title = 'Mocking a MagicMock with a function spec results in an AsyncMock'
    updated_at = <Date 2021-04-11.17:20:48.974>
    user = 'https://github.com/jeremycline'

    bugs.python.org fields:

    activity = <Date 2021-04-11.17:20:48.974>
    actor = 'matthew.suozzo'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2019-06-12.14:00:18.556>
    creator = 'jcline'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37251
    keywords = ['patch']
    message_count = 11.0
    messages = ['345358', '345377', '345399', '345704', '346091', '346150', '346583', '351385', '351621', '351644', '390689']
    nosy_count = 7.0
    nosy_names = ['lisroach', 'hroncok', 'mariocj89', 'miss-islington', 'xtreak', 'jcline', 'matthew.suozzo']
    pr_nums = ['14117', '15830', '15837', '25347']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37251'
    versions = ['Python 3.8', 'Python 3.9']

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of life3.9only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      Status

      No status

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions