-s 选项
-s选项允许终端在测试运行时输出某些结果,包括任何符合标准的输出流信息。-s等价于 --capture=no 。
#test_four.py
import pytest @pytest.mark.run_these_please def test_replace(): print("1111") assert 'sai' == 'saides'
--lf (--last-failed)选项
当一个或多个测试失败时,我们常常希望能够定位到最后一个失败的测试用例重新运行,这时可以使用--lf选项。
--ff (--failed-first)选项
--ff (--failed-first) 选项与--last-failed 选项的作用基本相同,不同之处在于--ff会运行完剩余的测试用例。
-q (--quiet)选项
它会简化输出信息,将-q和--tb=line (仅打印异常的代码位置)搭配使用