Dima Tisnek added the comment: I can, as shown in workaround #2.
However it's hackey when true side-effect's own return value has nothing in common with return value for the mock. The shortest workaround I managed is this: mock.Mock(side_effect=lambda *arg: db.update(...) or my_return_value) # relies on db.update returning None or more explicit like this: mock.Mock(side_effect=lamda *arg: db.update(...) or mock.DEFAULT, return_value=my_return_value) # -"- ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22541> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com