[New-bugs-announce] [issue31807] Using autospec=True conflicts with 'wraps'

John Villalovos report at bugs.python.org
Tue Oct 17 20:48:15 EDT 2017

New submission from John Villalovos <john at sodarock.com>:

If have autospec=True, then no ValueError is raised. If autospec=False or not defined, then the ValueError is raised.

import sys
from unittest import mock

def wrapped_func(value):
    raise ValueError(value)

@mock.patch('__main__.wrapped_func', autospec=True, wraps=wrapped_func)
def main(mock_wrap):


if '__main__' == __name__:

components: Library (Lib)
messages: 304549
nosy: John Villalovos
priority: normal
severity: normal
status: open
title: Using autospec=True conflicts with 'wraps'
type: behavior
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list