From 86f349c56cd2d1d168e60a4daece814ea60a5eb1 Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Fri, 10 May 2024 12:15:50 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9C=B0=E5=9D=80=202=E3=80=81=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/base_config.ini | 6 +++--- Utils/req_handler.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Config/base_config.ini b/Config/base_config.ini index 1089f6b..f5bd67c 100644 --- a/Config/base_config.ini +++ b/Config/base_config.ini @@ -27,13 +27,13 @@ formal_password = 123456789A address = 47.251.1.100 #端口 -port = 3306 +port = 13306 #账号 -account = willdesk +account = root #密码 -password = uitSElgrwLp6vFG +password = YKp-gmG28isz5qX [rerun] rerun = 1 diff --git a/Utils/req_handler.py b/Utils/req_handler.py index 46694b8..f7871de 100644 --- a/Utils/req_handler.py +++ b/Utils/req_handler.py @@ -2,6 +2,8 @@ import time import jsonpath import pymysql.err import warnings + +import pytest import requests import re import os @@ -141,9 +143,9 @@ class ReqHandler: try: assert res.status_code == 200 #先断言状态码是正确的 time = res.elapsed.total_seconds() - if time >= 4: - warnings.warn(f'接口响应时间过长,耗时{time}秒') - logger.error(f'接口响应时间过长,耗时{time}秒') + if time >= 5: + warnings.warn(f'接口响应时间过长,耗时{str(time)}秒',RuntimeWarning) #告警接口耗时过长 + logger.error(f'接口响应时间过长,耗时{str(time)}秒') if isinstance(expected,list): ''' 穿进来的expected一定是 {"eq":{$.code : value}} 的形式,要断言的值一定是通过jsonpath去检索的 -- GitLab