Author Dima.Tisnek
Recipients Dima.Tisnek, r.david.murray
Date 2014-10-02.13:51:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412257903.44.0.561604935256.issue22541@psf.upfronthosting.co.za>
In-reply-to
Content
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)  # -"-
History
Date User Action Args
2014-10-02 13:51:43Dima.Tisneksetrecipients: + Dima.Tisnek, r.david.murray
2014-10-02 13:51:43Dima.Tisneksetmessageid: <1412257903.44.0.561604935256.issue22541@psf.upfronthosting.co.za>
2014-10-02 13:51:43Dima.Tisneklinkissue22541 messages
2014-10-02 13:51:43Dima.Tisnekcreate