lundi 27 janvier 2020

How to make test that depends on parametrized test. (Pytest)

Why second test is skipped? I want second test to depend on three tests which are parametrized as test_first. How to make it happen?

import pytest
from pytest_dependency import depends
param = [10,20,30]
@pytest.mark.parametrize("param", param)
def test_first(param):
    assert(True)

@pytest.mark.dependency(depends=['test_first'])
def test_second():
    assert(True)

Output is

t.py::test_first[10] PASSED
t.py::test_first[20] PASSED
t.py::test_first[30] PASSED
t.py::test_second SKIPPED

I want t.py::test_second PASSED

p.s. It may be to asked before, but I decided to post the question anyway, because it is hard to find briefly formulated question about this problem.

Aucun commentaire:

Enregistrer un commentaire