如果代码块只有包含一条语句,Lambda表达式允许省略代码块的花括号,如果省略了代码块的花括 号,这条语句不要用花括号表示语句结束。
def allure_test(testcase_path, xml_path, mark=None):
    if not os.path.exists(xml_path):
        os.mkdir(xml_path)
    # 定义测试集
    args = ['--alluredir={path_allure}'.format(path_allure=xml_path)]
    # 标签
    if not mark:
        mark = COMMON['MARK']
    try:
        if testcase_path is not None:
            test_args = ['-q', testcase_path, '-m', mark]
            pytest.main(test_args + args)
        else:
            print("用户未选择执行项目,不执行")
    except Exception as e:
        print("Exception", str(e))