This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年04月20日 20:38 by r.david.murray, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg158883 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年04月20日 20:38 | |
I just spent an hour figuring out why my test was failing because I tried to do this: mymock.side_effect = (AuthenticationError, None) expecting the first call to raise an auth error and the second time it was called to get a normal return. Since there are almost zero circumstances in which one would really want to return an exception, is there any reason not to have mock check for exceptions and raise them in this circumstance? (If one did need to return an exception one could write a function...which is what one has to do now for the above case, but the above case seems more commonly needed than returning an exception would be.) |
|||
| msg158896 - (view) | Author: Michael Foord (michael.foord) * (Python committer) | Date: 2012年04月20日 22:38 | |
Seems like a good change. |
|||
| msg158922 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年04月21日 14:52 | |
New changeset c310233b1d64 by Michael Foord in branch 'default': Closes issue 14636. mock objects raise exceptions from an iterable side_effect http://hg.python.org/cpython/rev/c310233b1d64 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:29 | admin | set | github: 58841 |
| 2012年04月21日 14:52:19 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg158922 resolution: fixed stage: needs patch -> resolved |
| 2012年04月20日 22:38:08 | michael.foord | set | assignee: michael.foord messages: + msg158896 |
| 2012年04月20日 21:55:57 | eric.araujo | set | nosy:
+ eric.araujo |
| 2012年04月20日 20:38:09 | r.david.murray | create | |