支持多个story参数(用逗号分隔)

This commit is contained in:
qiaoxinjiu
2026-05-09 16:03:33 +08:00
parent 3adc7fa2b9
commit 0302d713e0

View File

@@ -145,7 +145,13 @@ def run_tests(target, test_type='all', **kwargs):
if not test_files: if not test_files:
print("错误: 未找到测试文件") print("错误: 未找到测试文件")
return 1 return 1
args = test_files + [f'--allure-stories={target}'] + base_args if ',' in target:
stories = [s.strip() for s in target.split(',')]
print(f"多个story标签: {stories}")
story_args = [f'--allure-stories={s}' for s in stories]
args = test_files + story_args + base_args
else:
args = test_files + [f'--allure-stories={target}'] + base_args
elif test_type == 'marker': elif test_type == 'marker':
print(f"按pytest标记运行: {target}") print(f"按pytest标记运行: {target}")
test_files = get_all_test_files() test_files = get_all_test_files()