pytest 斷言目前有幾種方法:
1、官方assert
就不介紹了,這種見官方文檔吧:https://docs.pytest.org/en/6.2.x/assert.html
2.第三方插件 py-assume
這個官方文檔:https://github.com/astraw38/pytest-assume
個人感覺不好用
3. 第三方插件pytest-check
官方文檔:https://github.com/okken/pytest-check
比第2個好用點
4. 其它方法
比如借用nose.tool中有斷言。不過需要裝nose
但nose 1.3.7版本只支持python2 python3也可以用。但支持不好。