[issue23661] Setting a exception side_effect on a mock from create_autospec does not work

2015-03-13 Thread Ignacio Rossi
Ignacio Rossi added the comment: The problem only affects autospecced functions. Apparently, the problem lies here (all code excerpts from Lib/unittest/mock.py): - When autospeccing functions, the Mock._mock_delegate field is populated at the end of _setup_func (and its the only place I found

[issue23661] Setting a exception side_effect on a mock from create_autospec does not work

2015-03-13 Thread Ignacio Rossi
New submission from Ignacio Rossi: The following fails on python 3.4.2, 3.4.3 and 3.5.0a2 (downloaded from python.org and compiled on Ubuntu 14.04). The same happens when using mock.patch with autospec=True. from unittest.mock import create_autospec def function(): ... pass ... mock