03 2021 档案
pytest中执行测试用例的几个方法(xfail, xpass, repeat, --count,--repeat-scope)
摘要:一.pytest.xfail & @pytest.mark.xfail(raises=ErrorType) 1.pytest.xfail: 将该用例标记成xfail失败,并且该用例中的后续代码不会执行 在测试用例中调用pytes.xfail()方法,可以选择传入reason参数表示原因 import
阅读全文
python 的slice切片函数
摘要:slice() 函数实现切片对象,主要用在切片操作函数里的参数传递。 类型: class slice(stop) class slice(start, stop[, step]) 参数说明: start -- 起始位置 stop -- 结束位置 step -- bu长 返回值:返回一个切片对象 举例
阅读全文
python 定时器 threading.timer到底怎么用?
摘要:自己摸索才能真正理解python的threading.Timer()定时器的用法。 首先让我们看下Timer的源码,怎么定义这个定时时间的: 需要操作的任务在达到设置的定时时间还没有结束,调用Timer()中:调用的函数/方法。 class Timer(Thread): """Call a func
阅读全文