现在这份工作一直做硬件和算法方面,但本人还是很喜欢玩web,所以自学分享一下。
如何安装pytest
其实很简单
pip install pytest
pip install -U pytest -U 表示升级
pytest和unittest的优劣势
快速入门写个小demo
import time
def add(x,y):
return x+y
def test_add2():
time.sleep(3)
assert add(1.2,4) == 4
执行失败的结果
import time
def add(x,y):
return x+y
def test_add2():
time.sleep(3)
assert add(0,4) == 4
执行成功的结果
Original: https://www.cnblogs.com/zqxFly/p/16312813.html
Author: 测试小张
Title: 初识pytest
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/585353/
转载文章受原作者版权保护。转载请注明原作者出处!