@pytest.mark.parametrize装饰器,数据驱动


一个参数a,依次传入值1,2,3,用列表传值

import pytest
@pytest.mark.parametrize('a',[1,2,3])
def testauto(a):
    assert a==3

两个参数a,b,用元祖传值

import pytest
@pytest.mark.parametrize('a,b',[(1,2),(3,4),(5,6)])
def testauto(a,b):
    assert a+b==3