def init_data(): data = [{"zhang", "123"}, {"lisang", "456"}] return data class test_skip: #单个参数 @pytest.mark.parametrize('name', ["tom", "zhang", "jun"]) def test_a(self,name): print(name) #多个参数 @pytest.mark.parametrize("username,password", init_data()) def test_b(self,username,password): print("用户名:%s,密码:%s 成功!"%(username,password))