aurzenligl / pytest-logger

Pytest plugin configuring handlers for loggers from Python logging module.
MIT License
35 stars 11 forks source link

using pytest-logger with pytest-rerunfailures plugin #35

Closed krzysiek6d closed 9 months ago

krzysiek6d commented 9 months ago

Hi

Let's have a test:

def test_random():
    import random
    assert random.choice([1,2,3,4]) == 2

It fails randomly. I'd like to use pytest-rerunfailures to run it copule of times and store log for every rerun if failed. Now pytest-logger stores only last run, so if finally test passes I do not have logs from reruns.

Do you have any idea how to connect those two plugins so I'll have logs from reruns? Then I could analyze what was wrong in random test

krzysiek6d commented 9 months ago

I managed to do that by copying files from logs to my 'reruns-' directory in pytest_runtest_makereport hooks