pytest,参数化第一个列表中的 x 和第二个列表中的 y

pytest, parametrize x in first list and y in second list

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 0
PASSED                            
[100%]['url1', 'url2', 'url3']
['xp1', 'xp2', 'xp3']

目标结果:

PASSED                                [ 33%]url1 xp1
PASSED                                [ 66%]url2 xp2
PASSED                                [100%]url3 xp3

对于一个列表,它适用于“@pytest.mark.parametrize("url", xlist)”,但我没有找到关于多个列表的信息。请问有什么解决办法吗?

@pytest.mark.parametrize("url, xp", zip(xlist, ylist))
class Test01:
    def test_001(self, url, xp):
        print(url)
        print(xp)

我找过这个。