Merge pull request #30 from zhao-george/master

feat: 增加csv多条件跳过用例功能,以&&符号隔开即可
This commit is contained in:
mikigo 2024-01-18 11:47:51 +08:00 committed by GitHub
commit ca3bc205af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 17 deletions

View File

@ -445,23 +445,25 @@ def pytest_collection_modifyitems(session):
pass
add_mark(item, ConfStr.SKIP.value, (tag,), {})
elif f"{ConfStr.SKIPIF.value}_" in tag:
skip_method, param = tag.split("-", maxsplit=1)
if hasattr(skipif, skip_method):
skip_result = getattr(skipif, skip_method)(param)
add_mark(
item,
ConfStr.SKIPIF.value,
(skip_result,),
{"reason": tag},
)
else:
logger.error(f"未找到判断是否跳过的自定义方法 <{skip_method}>")
add_mark(
item,
ConfStr.SKIP.value,
(f"未找到判断是否跳过的自定义方法 <{skip_method}>",),
{},
)
tag_list = tag.split("&&")
for _tag in tag_list:
skip_method, param = _tag.split("-", maxsplit=1)
if hasattr(skipif, skip_method):
skip_result = getattr(skipif, skip_method)(param)
add_mark(
item,
ConfStr.SKIPIF.value,
(skip_result,),
{"reason": _tag},
)
else:
logger.error(f"未找到判断是否跳过的自定义方法 <{skip_method}>")
add_mark(
item,
ConfStr.SKIP.value,
(f"未找到判断是否跳过的自定义方法 <{skip_method}>",),
{},
)
else: # 非跳过列
# 处理 pms id
if (