Skip to content

unittest.mock patch autospec doesn't work on staticmethods #67267

Description

@kevinbenton
BPO 23078
Nosy @cjw296, @voidspace, @PCManticore, @ambv, @berkerpeksag, @felipeochoa, @mariocj89, @tirkarthi, @tom-dalton-fanduel, @parejkoj, @atenni
PRs
  • bpo-23078: Add support for staticmethod and classmethod to mock created with autospec #11613
  • [3.7] bpo-23078: Add support for {class,static}method to mock.create_autospec() (GH-11613) #12901
  • Files
  • issue23078.patch
  • issue23078.patch
  • issue23078.patch: Update mock._callable to properly detect classmethod/staticmethod callables
  • 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 = 'https://github.com/berkerpeksag'
    closed_at = <Date 2019-04-22.03:08:29.819>
    created_at = <Date 2014-12-18.08:45:22.981>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = "unittest.mock patch autospec doesn't work on staticmethods"
    updated_at = <Date 2019-04-22.03:08:29.818>
    user = 'https://bugs.python.org/kevinbenton'

    bugs.python.org fields:

    activity = <Date 2019-04-22.03:08:29.818>
    actor = 'berker.peksag'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2019-04-22.03:08:29.819>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2014-12-18.08:45:22.981>
    creator = 'kevinbenton'
    dependencies = []
    files = ['37818', '37823', '40470']
    hgrepos = []
    issue_num = 23078
    keywords = ['patch']
    message_count = 19.0
    messages = ['232864', '234486', '234501', '234502', '244677', '250716', '305823', '310728', '322849', '330433', '330434', '330569', '330570', '333734', '333836', '333892', '340633', '340635', '340636']
    nosy_count = 18.0
    nosy_names = ['kormat', 'cjw296', 'michael.foord', 'Claudiu.Popa', 'lukasz.langa', 'berker.peksag', 'epu', 'galuszkak', 'fov', 'kevinbenton', 'mariocj89', 'germanop', 'deanliao', 'xtreak', 'tom.dalton.fanduel', 'John Parejko2', 'atenni', 'parejkoj-3']
    pr_nums = ['11613', '12901']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23078'
    versions = ['Python 3.7', 'Python 3.8']

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of life3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions