Refactoring doctests

This commit is contained in:
AmirElkess 2019-06-28 21:16:17 +02:00
parent 3c9b46f781
commit bf39e89946
1 changed files with 19 additions and 22 deletions

View File

@ -364,10 +364,7 @@ def _patch_unwrap_mock_aware():
contextmanager which replaces ``inspect.unwrap`` with a version
that's aware of mock objects and doesn't recurse on them
"""
real_unwrap = getattr(inspect, "unwrap", None)
if real_unwrap is None:
yield
else:
real_unwrap = inspect.unwrap
def _mock_aware_unwrap(obj, stop=None):
try: