使用方法:
@pytest.mark.skipif(condition,reason=None)
参数:
condition:跳过的条件,True(跳过、不执行)/False(不跳过、执行),必传参数
reason:标注原因
class test_skip: n=5 @pytest.mark.skipif(2 > 1, reason="如果条件为false就跳过") def test_a(self): print("跳过") def test_b(self): print("不跳过") @pytest.mark.skipif(n > 6, reason="如果条件为false就跳过") # 条件为boolean值,True(跳过)/False(不跳过/执行) def test_c(self): print("不跳过")