'''
@Author : 测试工程师Selina
@FileName : test_rule.py
@Description:
'''
import pytest
@pytest.mark.skip
def test_rule1():
assert 1 == 1
# ()里面的条件成立时跳过
@pytest.mark.skipif('1==2')
def test_rule2():
assert 2 == 2
print('pytest -q001')
# 12位手机号码
mobile = '170358979323'
# 手机号长度等于11位的时候跳过,因为不等于11位,所以不跳过会执行
@pytest.mark.skipif('len(mobile)==11')
def test_rule3():
assert 2 == 2
print('pytest -q002')
if __name__ == '_ _main_ _':
pytest.main(['s', 'test_rule.py'])
四、pytest接口自动化教程--skip和skipif用法
于 2023-11-25 18:05:16 首次发布