jeudi 20 décembre 2018

Pytest. Simultaneous use params and decorator parametrize

I want to remove the parametrization of the fixture autn from the parametrize decorator.

In the auth fixture, I use the autouse = True flag and pass parameters through params. All other fixtures are parameterized through parametrize. But it doesn't work the way i want

@pytest.fixture(scope="class", params=[('login1','1234'), ('login2', 
'1234')], autouse=True)
def auth(request):
user = request.param
login_with(login=user[0], pswd=user[1])


@pytest.mark.usefixtures("personal_page", "other_page")
@pytest.mark.parametrize('data', [(data)])
@pytest.mark.parametrize('table', [(MY_TABLE)])
def test_1_1(db):
    check(db)

There are twice as many tests and fixtures do not work consistently.

Aucun commentaire:

Enregistrer un commentaire