lundi 29 juin 2015

py.test change order of test inside the test class

I would like to change the order of test execution inside the test class when using @pytest.mark.parametrize fixture.

For example:

@pytest.mark.parametrize("param", ['test1', 'test2'])
class TestForTesting:
    def test_1(self, param):
        print param
    def test_2(self, param):
        print param

In this care py.test will run: test_1 with 'test1', 'test2' parameters and after that test_2 with 'test1', 'test2' parameters.

What I would like to do is to have it running in following order: test_1 with parameter 'test1' and then test_2 with parameter 'test1' and after that test_1 with parameter 'test2' and then test_2 with parameter 'test2'.

Is there any way to do this?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire