l1 = [10086, 10010, 110, 120]
code = ["xxx","ppppp","oooo","wwww"]
@pytest.mark.parametrize("mobile,code",zip(l1,code))
def test_case(mobile,code):
print(mobile,code)
assert 1
结果:
=========================================================== test session starts ============================================================
platform win32 -- Python 3.6.6, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 -- c:python36python.exe
cachedir: .pytest_cache
rootdir: D:s27day68, inifile: pytest.ini, testpaths: ./scripts
collected 4 items
scripts/test_case.py::test_case[10086-xxx] 10086 xxx
PASSED
scripts/test_case.py::test_case[10010-ppppp] 10010 ppppp
PASSED
scripts/test_case.py::test_case[110-oooo] 110 oooo
PASSED
scripts/test_case.py::test_case[120-wwww] 120 wwww
PASSED
============================================================ 4 passed in 0.07s =============================================================