pytest断言方法汇总

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也可以用。但支持不好。

 

posted @ 2022-01-14 15:32  Believer007  阅读(641)  评论(0编辑  收藏  举报