-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
added exception object to the TestReport #3361
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
added exception object to the TestReport #3361
Conversation
this completely breaks with xdist as reports are network transferrable and exception objects not it should be noted that the error section of the report should contain an accesible exception object (which gets turned into text by the xdist transfer) |
Thanks @brianmaissy, As @RonnyPfannschmidt commented this breaks xdist, unfortunately. pytest-xdist has its own serialization/unserialization code, which was a source of bugs in the past and makes it harder to implement the kind of change in this PR because we need to synchronize both Perhaps as a starting point @brianmaissy could contribute a patch moving serialization/unserialization code from We might even consider turning |
the topic is a bid convulve,d since we still have all the exception repressentation objects around that a) need porting, and b) leak to the externals as part of the serialization in a way i'd like to avoid unfortunately i lack the time to clean up the exception representation in a timely manner |
I see where you might be going, but some clarifications please:
You mean the
What do you mean? |
@nicoddemus if we make exceptions part of test report serialization in a structured way - we create a exterannly visible api, so if we leak it that way, we create a point where we either have to break people or keep something deprecated i dont meant the ReprExceptionInfo, but the ExceptionInfo itself |
@RonnyPfannschmidt your two comments below conflict directly with each other, so I'm still a little confused:
Having said that I agree that we can't make the exception info object part of the But I notice now that #3343 only needs access to the exception message, so perhaps we should add EDIT: @RonnyPfannschmidt perhaps is that what you meant with your first comment? |
@nicoddemus i just checked the code and i indeed did misremember, not an exception but an exception repr is stored |
Which code? This PR clearly stores And what's your opinion about adding |
im against that , we already put an exception repressentation in, we ought to take a look at that |
Can you elaborate? #3343 comments that they are already looking into |
@nicoddemus |
Hmm I see, I think you are right. Taking a look at the code, I would say we should give |
i question the approach of the exceptionrepr objects in general, i'd like to approach it in a serialize/display manner and do away with the current abstraction alltogether |
Not sure exactly what you mean, but seems like this could be done in another feature if/when someone has the time to do it. I don't see "repr" objects going away anytime soon. 😅 I would like for us to decide right now if we should close this issue or guide @brianmaissy in a practical and workable solution. I would prefer the latter, as aiming for the perfect solution usually takes a very long time. |
the exception repr objects should gain the metadata on the exception, thanks for cutting down the tangent thats more appropriate for a follow-up |
Thanks @RonnyPfannschmidt. @brianmaissy, I think we can continue from #3361 (comment), what do you think? |
sounds good |
Actually not sure I follow exactly what the proposal is. |
@brianmaissy this whole thing is a mess i'd love to just remove and rip out but cant due dot time and backward compat restraints ^^ - but its the thing that repressents exceptions, and as such it should get the attributes but it will loose those over network transfer since we coerce exceptions into strings as of now |
Ok. So we want to add It should determine them by parsing the And how will it get exposed in the |
They would not be lost, they are just
def exc_class_name(self):
return self._exc_info.type.__name__ if self._exc_info is not None else ''
def exc_message(self):
return safe_str(self._exc_info.value) if self._exc_info is not None else '' (Not sure why
Oh I was under the impression that |
@nicoddemus they would no longer be available on a xdist master |
Who? The |
@nicoddemus xdist turns the longrepr into a string as well as each of the sections that support it, so while its availiable on a worker, its gone on the master |
argh I see, thanks. |
Well I'm not sure what to do here, it seems we need to redesign how traceback and error representation is done in pytest, which seems like a major refactoring. @RonnyPfannschmidt you seem to have an idea of the direction you would like this to go, want to start brainstorming this in a separate issue with me and others interested? |
sounds good |
Closing so we can discuss in #3399 |
Fixes #3343