You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there was an exception in the wrapped hook, the result attribute will not exist at all, which will cause an AttributeError 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.
Activity
RonnyPfannschmidt commentedon May 31, 2016
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)
The-Compiler commentedon May 31, 2016
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.
RonnyPfannschmidt commentedon May 31, 2016
i think a nice way to solve this is to make
get_resultuse_resultand to have result as a alias property forget_resultnicoddemus commentedon May 31, 2016
I like @RonnyPfannschmidt's idea. 😁
I also have been bitten by this issue myself.
nicoddemus commentedon Sep 14, 2017
This has been changed already on
pluggy, but will become again a read-only property that callsget_result()under the covers in pytest-dev/pluggy#88.