格式 @pytest.mark.parametrize(variable,[value])
可以参考官方文档http://doc.pytest.org/en/latest/example/parametrize.html
@pytest.mark.parametrize(
"example_input,expectation",
[
(3, does_not_raise()),
(2, does_not_raise()),
(1, does_not_raise()),
(0, pytest.raises(ZeroDivisionError)),
],
)
def test_division(example_input, expectation):
"""Test how much I know division."""
with expectation:
assert (6 / example_input) is not None
这样,执行的时候,循环去读取每个tuplue的对应值