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

Incompatible with pytest lazy_fixture plugin

Open MRigal opened this issue 5 years ago • 4 comments

Hi all,

Probably similarly to #99 , incompatible with pytest lazy_fixture plugin

In conftest.py, I have the following:

@pytest.fixture
def print_one:
    print('one')

@pytest.fixture
def print_two:
    print('two')


@pytest.fixture(
    params=[
        lazy_fixture('print_one'),
        lazy_fixture('print_two'),
    ]
)
def parametrize_prints():
    pass

And consider the following failing test:

def test_foo(parametrize_prints):
    assert False

Running pytest --reruns 1 -k test_foo -s prints out

oneRF
twoRF

Although the fixture are well identified by pytest in the prints test_file.py::test_foo[print_one]

The example here is trivial, but in my case, I want the system to run some tests at specific times and the tests always pass on re-run because lazy_fixture with freezegun is never executed. This makes the rerunfailures plugin actually unsuitable for us :-(

MRigal avatar May 04 '20 21:05 MRigal

Can anyone have a look on this issue? I can also reproduce similar problem on my envrionment which causing rerun always fail.

refeved avatar Jan 26 '21 06:01 refeved

@MRigal I have never used lazy_fixtures before. What would you expect in this case? That the fixture is generated a second time?

sallner avatar Feb 15 '21 13:02 sallner

@sallner yes for sure! That it re-runs the same fixture

MRigal avatar Feb 15 '21 14:02 MRigal

If you tell me where to dig, I could give it a look, but I have only little knowledge of the internals of pytest and the plugin environment

MRigal avatar Feb 15 '21 14:02 MRigal