-l (--showlocals)选项
使用-l选项,失败测试用例由于被堆栈追踪,所以局部变量及其值都会显示出来。
#test_three.py
import pytest
@pytest.mark.run_these_please
def test_asdict():
assert ('finish book','brion',True,10) == ('finish book','brion',True,11)

--duration=N选项
--duration=N选项可以加快测试节奏。它不关心测试是如何运行的,只统计测试过程中哪几个阶段是最慢的(包括每个测试用例的call、setup、teardown过程)。

浙公网安备 33010602011771号