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
It works fine except for the traceback because if the test did not raise any exception, it's not in the trace anymore and the trace of the wrapper will be printed instead.
If i use the 'tracebackhide' variable to ignore the trace of the wrapper, the traceback is empty which raise an error like this:
.......
File "./venv/lib/python3.4/site-packages/_pytest/_code/code.py", line 418, in getrepr
return fmt.repr_excinfo(self)
File "./venv/lib/python3.4/site-packages/_pytest/_code/code.py", line 598, in repr_excinfo
reprtraceback = self.repr_traceback(excinfo)
File "./venv/lib/python3.4/site-packages/_pytest/_code/code.py", line 585, in repr_traceback
last = traceback[-1]
File "./venv/lib/python3.4/site-packages/_pytest/_code/code.py", line 289, in __getitem__
val = super(Traceback, self).__getitem__(key)
IndexError: list index out of range
Wouldn't it be useful to print the test body as traceback if it's empty? Instead of printing the pytest_runtest_call body (without tracebackhide) or raising an error (with tracebackhide).
It would be useful to mark cases of a parametrized test.
The text was updated successfully, but these errors were encountered:
max4t
changed the title
[feature] Use test body as traceback when empty
Use test body as traceback when empty
Mar 30, 2016
Hi,
I've added a 'raises' marker for my tests and to handle these, i've created a runtest wrapper like this:
It works fine except for the traceback because if the test did not raise any exception, it's not in the trace anymore and the trace of the wrapper will be printed instead.
If i use the 'tracebackhide' variable to ignore the trace of the wrapper, the traceback is empty which raise an error like this:
Wouldn't it be useful to print the test body as traceback if it's empty? Instead of printing the pytest_runtest_call body (without tracebackhide) or raising an error (with tracebackhide).
It would be useful to mark cases of a parametrized test.
The text was updated successfully, but these errors were encountered: