mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Autospec functions should propagate mock calls to parent GH-11273
This commit is contained in:
parent
f1b9abe35f
commit
9c3f284de5
3 changed files with 23 additions and 0 deletions
|
@ -321,6 +321,14 @@ class _CallList(list):
|
|||
|
||||
|
||||
def _check_and_set_parent(parent, value, name, new_name):
|
||||
# function passed to create_autospec will have mock
|
||||
# attribute attached to which parent must be set
|
||||
if isinstance(value, FunctionTypes):
|
||||
try:
|
||||
value = value.mock
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
if not _is_instance_mock(value):
|
||||
return False
|
||||
if ((value._mock_name or value._mock_new_name) or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue