-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning exceptions #23
Comments
I haven't thought about this (though maybe the original maintainer did -- we have mostly done bug fixes and Python version support updates since adopting the project). I would try to follow the patterns of the Python Patches that come with tests are welcome! |
Yes, of course. I’ve used that pattern for this type of testing in the past.
Ok, if time allows, I’ll put something together and submit a PR. Thanks!
… On Mar 4, 2021, at 7:16 PM, Tim Abbott ***@***.***> wrote:
I haven't thought about this (though maybe the original maintainer did -- we have mostly done bug fixes and Python version support updates since adopting the project). I would try to follow the patterns of the Python mock library for this sort of thing; and so I wouldn't conflate a return value (returning an exception object) with raising an exception in the syntax. See https://docs.python.org/3/library/unittest.mock.html <https://docs.python.org/3/library/unittest.mock.html> ; I think we probably would want to call this side_effect.
Patches that come with tests are welcome!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#23 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAK4Q5D3PCD44NPLHRUQVPLTCAPEVANCNFSM4YUCX55A>.
|
Has consideration been given to allowing tests to pass in an exception to return? E.g.
self.mock_ldap.set_return_value( "simple_bind_s", ("cn=admin,dc=mgb,dc=org", "ldaptest"), ldap.SERVER_DOWN )
The text was updated successfully, but these errors were encountered: