☯☯☯☯☯☯没有期望 何来失望 做一只快乐的咸鱼 - 北陌☯☯☯☯☯☯

pytest-Mark数据驱动

数据驱动

import pytest

@pytest.mark.parametrize(("a", "b", "expected"), [
    [1, 2, 3],
    [10, 11, 21],
    [1, 1, 1],
])
def test_1(a, b, expected):
    assert a + b == expected

if __name__ == "__main__":
    pytest.main(["-v"])
==================================
test_pytest.py::test_1[1-2-3] PASSED        [ 33%]
test_pytest.py::test_1[10-11-21] PASSED     [ 66%]
test_pytest.py::test_1[1-1-1] FAILED        [100%]

 

posted @ 2019-04-30 10:23  Mr、北陌  阅读(1088)  评论(0编辑  收藏  举报