-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Making _CallOutcome.result private in 3.0 #1572
Comments
please report against pluggy i think we could get by by creating a non-data descriptor that raises the actual exception from the actual traceback when used (non-data descriptors get only triggered if the instance does not have an attribute of the same name) |
I reported it here because it'll be a backwards compatibility break in pytest and mainly affect pytest code and users 😉 I guess that'd work as well, but it strikes me as quite weird that an attribute access would raise a (non-AttributeError) exception. |
i think a nice way to solve this is to make |
I like @RonnyPfannschmidt's idea. 😁 I also have been bitten by this issue myself. |
This has been changed already on |
I propose to rename
pluggy._CallOutcome.result
to_result
with pytest 3.0. It seems to be a common mistake to use.result
instead ofget_result()
:If there was an exception in the wrapped hook, the
result
attribute will not exist at all, which will cause anAttributeError
which hides the exception which actually happened.To avoid that mistake, I think it'd be better to only use the attribute internally and only provide
get_result
as external API.The text was updated successfully, but these errors were encountered: