Skip to content

Commit

Permalink
Merge 138e22d into 33bb75b
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Nov 29, 2020
2 parents 33bb75b + 138e22d commit 40dc326
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 1,249 deletions.
18 changes: 18 additions & 0 deletions tests/patchers.py
Expand Up @@ -143,3 +143,21 @@ class CustomException(Exception):


PATCH_CONNECT_FAIL_CUSTOM_EXCEPTION = {KEY_PYTHON: patch("{}.{}.connect".format(__name__, ADB_DEVICE_TCP_FAKE), side_effect=CustomException), KEY_SERVER: patch("{}.{}.device".format(__name__, CLIENT_FAKE_SUCCESS), side_effect=CustomException)}


def patch_calls(obj, wraps):
"""Patch a method call without changing its behavior.
Parameters
----------
obj
The object whose method will be patched (i.e., `self`)
wraps
The method that is being patched (i.e., `self.method`)
Returns
-------
The patched method
"""
return patch.object(type(obj), wraps.__name__.split()[-1], wraps=wraps)

0 comments on commit 40dc326

Please sign in to comment.