Message280795
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': 'mymodule.Class1'
}
root_mock = mock.Mock()
for name, path in patches.items():
m = mock.patch(path, autospec=True)
root_mock.attach_mock(m.start(), name)
import requests
import mymodule
mymodule.Class1('foo')
requests.get('bar')
print root_mock.mock_calls
# [call.mymodule_Class1('foo')]
Does this working as expected make sense, or is there some reason this is
an undesirable API to behave consistently regardless of what's being
patched? |
|
Date |
User |
Action |
Args |
2016-11-14 17:04:07 | anfedorov | set | recipients:
+ anfedorov, michael.foord, shmed |
2016-11-14 17:04:07 | anfedorov | link | issue28569 messages |
2016-11-14 17:04:07 | anfedorov | create | |
|