-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
pytrace=False
and "--tb=line" reports "None"
#10831
Comments
pytrace=False
and "--tb=line" reports "None"
Hello, first-time contributor here, so I'm very open to any suggestions on any of the following! The IssueI've managed to track down this issue to lines 448 and 449 in the function
It seems that the test case above creates an Because the style is reset to "value", the repr_chain is appended to by the following code (Line 953-956 of code.py)
This propagates through a trail of function calls, eventually causing the bug in a call to
Suggested FixThe easiest solution I could find is to add a simple check in nodes.py that prevents the "line" style from being overridden when excinfo.value.pytrace is False, i.e.
I'm planning on opening a PR for this issue tomorrow (as soon as I can get a test or two set up to double-check this works) but of course any feedback is welcome in the meantime. |
I don't think it would be right to call |
I'd probably do something like:
I'm not a core contributor though, so just my opinion here. |
Very good point on the expectedness of the However, I think it might still be better to make sure that
|
Hey folks, Thanks for the discussion! But before we think on a fix, what did you expect the result would be in that case? I agree |
@nicoddemus I'd expect the output to remain the same (updated in the issue body):
|
I think the |
I see you've done some similar work on issues related to this in the past @bluetech, and looking into it I definitely agree that seems to be the norm for other I would assume that |
Looking at it again, I take my previous comment back. I think |
Closes #10831. This fixes a small bug where running tests that contained `pytest.fail(pytrace=False)` with the `--tb=line` flag set results in an output of "None" in the Failures section of the output, and adds a test to ensure the behavior is correct.
Thanks @acjreno! |
Given test changed as
and invoked as
results in output
Expected: Output remains the same
The text was updated successfully, but these errors were encountered: