跳过:

import pytest
def test_case_01():
assert 1

#无条件跳过类:
@pytest.mark.skip()
class TestCase(object):
"""加装饰器跳过测试用例"""
@pytest.mark.skip(condition=True, reason="我就想跳过")
def test_case_01(self):
assert 1

#用skip就是无条件跳过:
@pytest.mark.skip(condition=1 > 2, reason="我就想跳过")
def test_case_02(self):
assert {"title":"v2ex"} != {"title":"V2EX"}

def test_case_03(self):
assert 1
#skipif就是有条件跳过:
@pytest.mark.skipif(condition=1 < 2, reason="我就想跳过")
def test_case_04(self):
assert 1

猜你喜欢

转载自www.cnblogs.com/zhang-da/p/12219290.html
今日推荐