import pytest # 多个参数(’class1,class2‘,[('age','eat'),('age','eat')]) @pytest.mark.parametrize('dog,cat',[('2','bone'),('1','fish')]) def test_params(dog,cat): assert 1==1
Testing started at 20:43 ... Launching pytest with arguments test_params.py::test_params --no-header --no-summary -q in D:\pythonProject0726\test_case ============================= test session starts ============================= collecting ... collected 2 items test_params.py::test_params[2-bone] PASSED [ 50%] test_params.py::test_params[1-fish] PASSED [100%] ============================== 2 passed in 0.01s ============================== Process finished with exit code 0