Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 增加csv多条件跳过用例功能,以&&符号隔开即可 #30

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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