Commit d11bbce8 authored by zhanhuasheng's avatar zhanhuasheng

注释处理

parent cf430e35
...@@ -130,7 +130,7 @@ class ReqHandler: ...@@ -130,7 +130,7 @@ class ReqHandler:
value = list(item_value.values())[0] value = list(item_value.values())[0]
res_path_value = jsonpath.jsonpath(res.json(),path)[0] res_path_value = jsonpath.jsonpath(res.json(),path)[0]
if isinstance(res_path_value,str) and '{"contentList":' in res_path_value: if isinstance(res_path_value,str) and '{"contentList":' in res_path_value:
res_path_value = res_path_value.replace('\\','') res_path_value = res_path_value.replace('\\','') #兼容websocket,当遇到包含{"contentList":内容的值,且类型是字符串时,会自动去除所有\号
if assert_way == 'eq': #eq代表完全相同 if assert_way == 'eq': #eq代表完全相同
assert value == res_path_value assert value == res_path_value
elif assert_way == 'like': #代表值相同但是type可能不同 elif assert_way == 'like': #代表值相同但是type可能不同
...@@ -141,13 +141,11 @@ class ReqHandler: ...@@ -141,13 +141,11 @@ class ReqHandler:
assert round(value,2) == round(res_path_value,2) assert round(value,2) == round(res_path_value,2)
elif assert_way == 'in': #in代表断言值在返回值中 elif assert_way == 'in': #in代表断言值在返回值中
assert value in res_path_value assert value in res_path_value
elif assert_way == 'ain': elif assert_way == 'ain':#ain代表返回值在断言值中
assert res_path_value in value assert res_path_value in value
except AssertionError: except AssertionError:
print(f'期望值为{value}{type(value)}),实际返回值为{res_path_value}{type(res_path_value)}),完整的expected体为{expected}') print(f'期望值为{value}{type(value)}),实际返回值为{res_path_value}{type(res_path_value)}),完整的expected体为{expected}')
raise AssertionError raise AssertionError
except Exception as e:
print(e,'-----------------')
def set_value_handler(self,res,item,var_class): def set_value_handler(self,res,item,var_class):
''' '''
:param res: 传response请求体 :param res: 传response请求体
......
import pytest import pytest
import os import os
from Utils.sql_handler import test_env_conn from Utils.sql_handler import test_env_conn
from Utils import websocket_handler
if __name__ == '__main__': if __name__ == '__main__':
try: try:
pytest.main(['-vs','TestCase/inbox',f'--alluredir=./allureReports','--clean-alluredir']) pytest.main(['-vs',f'--alluredir=./allureReports','--clean-alluredir'])
# result = subprocess.run(['allure', 'generate', './allureReports', '-o', './allure-report', '--clean'])
# os.system('allure generate ./allureReports -c -o ./allureOutput')
finally: finally:
print('finally') test_env_conn.close_db() #关闭数据库链接
test_env_conn.close_db()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment