[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2014-04-14 Thread Michael Foord
Changes by Michael Foord : -- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed ___ Python tracker ___ _

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2014-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1e3c64470629 by Michael Foord in branch '3.4': Issue 17826. Setting an iterable side_effect on a mock created by create_autospec now works http://hg.python.org/cpython/rev/1e3c64470629 -- nosy: +python-dev _

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2014-04-14 Thread Kushal Das
Kushal Das added the comment: New patch with fix in proper place for side_effect for functions (includes test case). -- versions: +Python 3.3 -Python 3.5 Added file: http://bugs.python.org/file34838/issue17826_v3.patch ___ Python tracker

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2014-04-14 Thread Michael Foord
Michael Foord added the comment: Can you explain why we need to check for the call_count here? I don't understand why this is needed. -- ___ Python tracker ___ _

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2014-04-10 Thread Éric Araujo
Éric Araujo added the comment: Michael, a patch including tests is ready for this issue. -- nosy: +eric.araujo stage: patch review -> commit review versions: +Python 3.5 -Python 3.3 ___ Python tracker _

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-28 Thread Kushal Das
Kushal Das added the comment: Version 2 of the patch, with typo fixed also one more addition test to check callable side effect in create_autospec. -- Added file: http://bugs.python.org/file30055/issue17826_v2.patch ___ Python tracker

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-27 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mailin

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-26 Thread Kushal Das
Kushal Das added the comment: Patch along with a test for the same. -- keywords: +patch Added file: http://bugs.python.org/file30025/issue17826_v1.patch ___ Python tracker ___ __

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-26 Thread Kushal Das
Kushal Das added the comment: Working on this. -- nosy: +kushaldas ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-26 Thread Michael Foord
Michael Foord added the comment: This illustrates the difference: >>> from mock import Mock, create_autospec >>> some_list = [1, 2, 3] >>> m = Mock() >>> m.side_effect = some_list >>> m.side_effect >>> m2 = create_autospec(lambda: None) >>> m2.side_effect = some_list >>> m2.side_effect [1, 2, 3

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-24 Thread Gregory P. Smith
Changes by Gregory P. Smith : -- nosy: +gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-24 Thread Michael Foord
New submission from Michael Foord: >>> from unittest.mock import create_autospec >>> def f(): pass ... >>> m = create_autospec(f) >>> m.side_effect = [1, 2] >>> m() Traceback (most recent call last): File "", line 1, in File "", line 3, in f File "/compile/py3k-cpython/Lib/unittest/mock.p