Message279812
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.start(), 'requests_get')
>>> import requests
>>> requests.get('https://google.com')
<MagicMock name='get()' id='4472381392'>
>>> manager.mock_calls
[]
>>> p.stop()
>>> manager.mock_calls
[]
It seems this would be a useful use-case, especially given that this code would work as-expected if 'requests.get' in the second line were replaced with a path to a class. |
|
Date |
User |
Action |
Args |
2016-10-31 17:32:14 | anfedorov | set | recipients:
+ anfedorov, michael.foord |
2016-10-31 17:32:14 | anfedorov | set | messageid: <1477935134.31.0.733482108189.issue28569@psf.upfronthosting.co.za> |
2016-10-31 17:32:14 | anfedorov | link | issue28569 messages |
2016-10-31 17:32:13 | anfedorov | create | |
|