-
Notifications
You must be signed in to change notification settings - Fork 586
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
Tidy up the tracebacks in the case of multiple failures #848
Comments
|
I’m not going to look at this more now, but going after the |
|
+1 on tidying this up. I think there are two different parts to doing this:
P.S. You may or may not have realised this, but that example would work even if all of the exceptions were of the same type - disambiguation is by both type and line |
|
Fixing this will probably be in the I suggest starting by replacing the traceback with a completely different string, and checking that it works as you'd expect with the simple example above. Then, you can filter out lines associated with something that |
|
I've tried this suggested format in #1225, and it looks good! There is some repetition remaining though - I suspect because the outer function has been replaced by a proxy. An optional part of this feature would be to detect adjacent duplicate lines and remove one. Either way, the filtering should be skipped when in verbose or debug mode. |
|
Looking into this. |
|
https://vorpus.org/blog/beautiful-tracebacks-in-trio-v070/ Some really impressive work here, with a lovely example and (importantly) links to the issues and PRs where the code was designed and done. Short tips - we'll probably want to do all of these:
But my main takeaway is that this can work really, really well! |
|
master...Zac-HD:short-tracebacks Before: see above. After: Traceback (most recent call last):
File "c:\users\zac\documents\github\hypothesis\hypothesis-python\src\hypothesis\core.py", line 935, in wrapped_test
raise clip_traceback(error)
hypothesis.errors.MultipleFailures: Hypothesis found 3 distinct failures.
--------------------------------- Hypothesis ----------------------------------
Falsifying example: test(x=-101)
Traceback (most recent call last):
File "C:\Users\Zac\Documents\GitHub\hypothesis\test.py", line 19, in test_x_is_not_integer
raise RuntimeError("This number is too small!")
RuntimeError: This number is too small!
Falsifying example: test(x=101)
Traceback (most recent call last):
File "C:\Users\Zac\Documents\GitHub\hypothesis\test.py", line 17, in test_x_is_not_integer
raise ValueError("This number is too big!")
ValueError: This number is too big!
Falsifying example: test(x=1)
Traceback (most recent call last):
File "C:\Users\Zac\Documents\GitHub\hypothesis\test.py", line 21, in test_x_is_not_integer
raise ZeroDivisionError("This number is too close to 0")
ZeroDivisionError: This number is too close to 0Still proof-of-concept, but I'm pretty happy with ~three hours work 😄 |
Consider the following test:
This is the output in Hypothesis 3.25.0, and there's a lot of it:
A bunch of Hypothesis traceback is mixed into the test. It might be nicer if we could render it as follows:
So the traceback for each falsifying example starts and ends in user code.
I have no idea how hard this is to do, but it’s an idea.
The text was updated successfully, but these errors were encountered: