Skip to content

Commit

Permalink
feat: 增加csv多条件跳过用例功能,以&&符号隔开即可
Browse files Browse the repository at this point in the history
Description: 增加csv多条件跳过用例功能,以&&符号隔开即可

Log: 增加csv多条件跳过用例功能,以&&符号隔开即可
  • Loading branch information
zhao-george committed Jan 18, 2024
1 parent 891864c commit 81d837e
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 81d837e

Please sign in to comment.