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%]

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM