zoukankan      html  css  js  c++  java
  • pytest跳过测试函数

    使用方法:

    @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("不跳过")
    

      

  • 相关阅读:
    Codeforces_731_C
    Codeforces_731_B
    Codeforces_731_A
    HDU_1035_水
    POJ_3450_KMP
    POJ_2185_二维KMP
    POJ_2752_KMP
    Codeforces_492_E
    Codeforces_338_D
    Codeforces_327_C
  • 原文地址:https://www.cnblogs.com/chongyou/p/12634776.html
Copyright © 2011-2022 走看看