如果你还想从头学起Pytest,可以看看这个系列的文章哦!
https://www.cnblogs.com/poloyy/category/1690628.html
pytest中可以用python的assert断言,也可以写多个断言,但一个失败,后面的断言将不再执行
pip3 install pytest-assume -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
def test_add1():
assert 1 + 4 == 5
assert 1 + 3 == 3
assert 2 + 5 == 7
assert 2 + 5 == 9
print("测试完成")
可以看到,第二行断言失败之后,后面的断言也不会执行,包括正常的代码
def test_add2():
pytest.assume(1 + 4 == 5)
pytest.assume(1 + 3 == 3)
pytest.assume(2 + 5 == 7)
pytest.assume(2 + 5 == 9)
print("测试完成")