-
Notifications
You must be signed in to change notification settings - Fork 124
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
Deprecate _Result.excinfo
#155
Conversation
pluggy/callers.py
Outdated
"""Get the exception info for this hook call (DEPRECATED in favor of | ||
``get_result()``). | ||
""" | ||
msg = 'Use `get_result()` which raises the underlying exception' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe for clarity of the warning the property should be referenced in the text somehow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @RonnyPfannschmidt's suggestion, other than that LGTM.
cd6b8fa
to
a152554
Compare
@RonnyPfannschmidt @nicoddemus pushed the change hopefully it's good enough 👍 |
a152554
to
aad70f7
Compare
@nicoddemus what's the recommended way to make CI happy here? I kind of want to keep failure on unexpected deprecation warnings but we also can't wrap |
@tgoodlet i beleive we need to set up pytest awrning filters in a way that we dont error on plugy warnings and make a pytest release where we dont fail anymore |
I think @RonnyPfannschmidt's suggestion is on point. 👍 |
@nicoddemus gonna rebase this and put in a |
796a471
to
1b46b3f
Compare
@nicoddemus @RonnyPfannschmidt also do you both mind checking I did the |
Awesome! |
Strange, I would expect the warnings to show only once, not for every call... |
@@ -0,0 +1 @@ | |||
Deprecate ``_Result.excinfo`` in favor of ``_Result.get_result()``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a D
here 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait what?
Just checking the problematic code in pytest. @hookimpl(hookwrapper=True)
def pytest_pyfunc_call(pyfuncitem):
check_xfail_no_run(pyfuncitem)
outcome = yield
passed = outcome.excinfo is None
if passed:
check_strict_xfail(pyfuncitem) becomes: @hookimpl(hookwrapper=True)
def pytest_pyfunc_call(pyfuncitem):
check_xfail_no_run(pyfuncitem)
outcome = yield
try:
outcome.get_result()
passed = True
except Exception:
passed = False
if passed:
check_strict_xfail(pyfuncitem) TBH doesn't look like an improvement to me. Or am I missing something? (To be clear, totally in favor about the deprecation of |
@nicoddemus I also think it's a little uglier but @RonnyPfannschmidt seemed convinced in #86. |
I completely see the point of deprecating However for |
@nicoddemus btw we can also chat now on the new gitter channel! |
@RonnyPfannschmidt still waiting on your input for this one. |
@nicoddemus the question does become if we should expose the actual exception, from my pov, the concrete values of exception/result should be hidden away, the following questions come up to me
|
You mean a single use in pytest, or in a more general manner, like a single use case (verify if any exception has occurred)? |
@nicoddemus in that case single use of the value in pytest - i believe its important to consider point 2 in relation |
A quick search shows that the only use case is indeed if a plugin is interested only if an exception has occurred or not. TBH if we were discussing about including the API for |
i find that reasoning acceptable, on principle i'd still prefer if we had a success/failure indicator instead of exposing the exception |
That would work for pytest, but I did see some code in that search I posted before that were checking for a specific type of exception. Also, we need to realize that we can always deprecate |
@nicoddemus do you have a link, at least on github most of the results are accidentally committed tox virtualenvs |
Yeah those generate a lot of noise. I could find a few instances mostly in pytest plugins, for example: |
@nicoddemus all examples you linked use |
Oh you are right. Anyway, the code in those links will still need to be updated eventually... well I will leave up to you then, I don't have any strong arguments anymore. 👍 |
https://github.com/Authentise/pytest-raises/blob/aaa4999d3d79f3a07dfd6f8b6a6c01df827fecd2/pytest_raises/pytest_raises.py#L24 https://github.com/search?q=%22outcome.excinfo+is+None%22&type=Code as per those its in actual usage (and github is just really bad to search code) |
however it should be noted that all uses of the code would tremendously benefit from a failure indication |
based on the information we collected i believe its only fair to keep the api, we should also consider introducing a failure indication as an orthogonal matter |
You have a suggestion? I think two read-only properties, |
failed/passed dont quite match - its not a test - ill sleep over it |
Sounds good! 👍 |
Closing according to the consensus that we keep |
Resolves #86