xlist = ["url1", "url2", "url3"]ylist = ["xp1", "xp2", "xp3"]@pytest.mark.parametrize("url, xp", [(xlist, ylist)])class Test01: def test_001(self, url, xp): print(url) print(xp)结果:Process finished with exit code 0PASSED [100%]['url1', 'url2', 'url3']['xp1', 'xp2', 'xp3']目标结果:PASSED [ 33%]url1 xp1PASSED [ 66%]url2 xp2PASSED [100%]url3 xp3对于一个列表,它适用于“@pytest.mark.parametrize(“url”, xlist)”,但我没有找到关于多个的东西。请问有什么解决办法吗?
1 回答
收到一只叮咚
TA贡献1821条经验 获得超4个赞
@pytest.mark.parametrize("url, xp", zip(xlist, ylist))
class Test01:
def test_001(self, url, xp):
print(url)
print(xp)
我找过这个。
添加回答
举报
0/150
提交
取消