pytest.mark.parametrize多参数同时使用提示names : must be equal to the number of values

阅读 64

2023-05-25

需求:abcd四个参数组合传入作为一条case

参数化如下:

@pytest.mark.parametrize("a,b,c,d", [data_a, data_b, data_c, data_d])

运行时提示

the number of names (4):

  [a, b, c, d]

must be equal to the number of values (5):

  data_a

原因貌似是没有将[]内的数据识别成一个整体,改为在数据外围加一层括号,成功:

@pytest.mark.parametrize("a,b,c,d", [(data_a, data_b, data_c, data_d)])

精彩评论(0)

0 0 举报