lundi 1 juin 2015

How to mark test as xfail only with specific parameters with Pytest

I'm quite new to pytest and I would like to know, how to mark test as "expected to fail" with certain parameters. I parametrize test e.g. like this:

@pytest.mark.parametrize("param1", [False, True])
@pytest.mark.parametrize("param2", [1, 2, 3])
def test_foo(self, param1, param2):
    ...

What I'm trying to achieve is that when (param1 == True and param2 == 2), the test should fail, but I haven't found any way to do this. (Other parameter combinations should pass).

Do you have any ideas?

Thank you

Aucun commentaire:

Enregistrer un commentaire