1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import json
- from pathlib import Path
- import allure
- import pytest
- from common.parameterize import ddt, read_testcase
- from common.request_util import RequestUtil
- path = Path(__file__).parent.glob("**/*.yaml")
- def creat_case(yaml_path):
- @pytest.mark.parametrize("arg_names", read_testcase(rf"{yaml_path}"))
- def test_fun(self, arg_names):
- allure.dynamic.title(arg_names["name"])
- RequestUtil("base_qccq_sc").standard_yaml(arg_names)
- return test_fun
- @allure.epic("青春重庆")
- @allure.feature("用户管理模块")
- class TestAPI:
- pass
- # for yaml_path in path:
- # yaml_name = yaml_path.name[:-5]
- # setattr(TestAPI, yaml_name, creat_case(yaml_path))
- data = []
- for yaml_path in path:
- data.append(yaml_path)
- data.sort()
- for yaml_path in data:
- yaml_name = yaml_path.name[:-5]
- setattr(TestAPI, yaml_name, creat_case(yaml_path))
|