浏览代码

新增功能

“蒋伟” 5 月之前
父节点
当前提交
14b1d1b7bb
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 4 0
      common/yaml_util.py
  2. 2 1
      conftest.py

+ 4 - 0
common/yaml_util.py

@@ -33,6 +33,10 @@ def clear_yaml():
         f.truncate()
 
 
+def clear_out_yaml():
+    with open(os.getcwd() + '/out_time_url..yaml', mode='w', encoding='utf-8') as f:
+        f.truncate()
+
 # 读取测试用列
 def read_testcase(yaml_path):
     with open(yaml_path, mode='r', encoding='utf-8') as f:

+ 2 - 1
conftest.py

@@ -5,7 +5,7 @@ from pathlib import Path
 import pytest
 import requests
 
-from common.yaml_util import clear_yaml, read_testcase, read_config_yaml, write_yaml
+from common.yaml_util import clear_yaml, read_testcase, read_config_yaml, write_yaml, clear_out_yaml
 
 path = Path(__file__).parent.glob("**/test_001_登录接口.yaml")
 for yaml_path1 in path:
@@ -19,6 +19,7 @@ for yaml_path1 in path:
 @pytest.fixture(scope="session", autouse=True)
 def clear_yam():
     clear_yaml()
+    clear_out_yaml()
     login_system(yaml_path)