Skip to content

Commit

Permalink
Attempt to fix patch.multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Feb 22, 2017
1 parent a9eef3a commit 3f890f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion case/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ def _patch_sig2(target, attribute,
return new, autospec, new_callable


def _patch_sig_multiple(target,
spec=None, create=False, spec_set=None,
autospec=None, new_callable=None, **kwargs):
# New is always set, don't have to specify new_callable
return True, autospec, new_callable


def _create_patcher(fun, signature):

@wraps(fun)
Expand All @@ -215,7 +222,7 @@ def patcher(*args, **kwargs):

patch = _create_patcher(mock.patch, _patch_sig1)
patch.dict = mock.patch.dict
patch.multiple = _create_patcher(mock.patch.multiple, _patch_sig2)
patch.multiple = _create_patcher(mock.patch.multiple, _patch_sig_multiple)
patch.object = _create_patcher(mock.patch.object, _patch_sig2)
patch.stopall = mock.patch.stopall
patch.TEST_PREFIX = mock.patch.TEST_PREFIX
Expand Down

0 comments on commit 3f890f1

Please sign in to comment.