samedi 14 juillet 2018

How to make dependent parametrization in pytest?

For example, I have this test data:

PARAMS = {'pic1': [1, 2, 3], 'pic2': [14, 15], 'pic3': [100, 200, 300]}

I need to download each key-picture from this PARAMS and generate separate tests [1, 2, 3], that will use this picture. After that when each test of 'pic1': [1, 2, 3] pair ends, remove picture, then download the next one, and so on... Roughly speaking, generated tests should look like this:

test_pic[pic1-1]
test_pic[pic1-2]
test_pic[pic1-3]
test_pic[pic2-14]
test_pic[pic2-15]
test_pic[pic3-100]
test_pic[pic3-200]
test_pic[pic3-300]

but inside will be a download image logic.

I did not find a way how to do it in pytest.

Please help.

Aucun commentaire:

Enregistrer un commentaire