pytest-rerunfailures icon indicating copy to clipboard operation
pytest-rerunfailures copied to clipboard

Please add option to show failure messages for all reruns

Open vyahello opened this issue 4 years ago • 2 comments

Problem: pytest-rerunfailures plugin shows only assertion message from the last launched test case. From the code snippet, it is tough to identify what went wrong on the first and second attempts.

~  pytest test_one.py --reruns 2 -v   

test_one.py::test_fail RERUN    [100%]
test_one.py::test_fail RERUN    [100%]
test_one.py::test_fail FAILED   [100%]

================================ FAILURES ==================================
________________________________ test_fail _________________________________

def test_fail():
>       assert False, 'Fake message'
E       AssertionError: Fake message
E       assert False

test_one.py:5: AssertionError

============================== short test summary info ======================
FAILED test_one.py::test_fail - AssertionError: Fake message
================================ 1 failed, 2 rerun in 0.13s =================

It would be extremely useful (especially in debugging) to see all previous assertion messages such as described in the FAILURES section for the last failed test case. For instance, the last assertion message does not mean that all previous tests failed with the same reason.

The solution I would like to see: I would like to see some extra argument that will allow launching logs for all failed/rerun testcases. As far as I see from the code below failure logging is omitted at all (log=False): https://github.com/pytest-dev/pytest-rerunfailures/blob/3f8685e4bb92659fb3eab76aa624ad1244ca9770/pytest_rerunfailures.py#L276 It would be great if a new argument will allow to manage log parameter so that user will take control on logging failures.

I know that we can extend test summary with -r rR option, but unfortunately, it is not enough.

vyahello avatar Mar 31 '21 20:03 vyahello

A pull request is welcome, I like this idea, too, and was missing the outputs of the previous runs several times.

icemac avatar Jun 23 '23 06:06 icemac