Andrey Fedorov added the comment:
Here's the full extension of the example from documentation that doesn't
seem to handle classes and functions consistently:
import mock
patches = {
'requests_get': 'requests.get',
'mymodule_Class1
Andrey Fedorov added the comment:
To clarify, this is how I would expect these two functions to work together
"out of the box"
patches = { 'requests_get': 'requests.get', ... }
root_mock = mock.Mock()
for name, path in patches.items():
m = m
Andrey Fedorov added the comment:
There's some vagueness on how this is implemented, but I would prefer
manager.attach_mock to also work with whatever the return value of patch()
is.
On Fri, Nov 11, 2016 at 12:08 PM, Syed Suhail Ahmed
wrote:
>
> Syed Suhail Ahmed added the comm
Changes by Andrey Fedorov :
--
title: mock.attach_mock should work with return value of patch() ->
mock.attach_mock should work with any return value of patch()
___
Python tracker
<http://bugs.python.org/issu
New submission from Andrey Fedorov:
The attach_mock in the following code sample fails silently:
>>> from mock import patch, Mock
>>> p = patch('requests.get', autospec=True)
>>> manager = Mock()
>>> manager.attach_mock(p.st