class MyMock(MagicMock):

    def __init__(self, *args, **kwargs):
        MagicMock.__init__(self, *args, **kwargs)
self._kids = []

def __call__(self, *args, **kwargs):
    result = MagicMock.__call__(self, *args, **kwargs)
self._kids.append((args, kwargs, result))
return result
Find the parent mock object of a child, child mock objects of a parent