当前位置 : 主页 > 网络安全 > 测试自动化 >

AppUi自动化框架tool.py代码

来源:互联网 收集:自由互联 发布时间:2021-06-19
import json import os from lib.path import APPPATH from lib.path import APPPICTUREPATH, APPERROR import threading import yaml from lib.logger import logger class Tool(object): @property def app_data(self): with open(APPPATH, ‘rb‘) as f:
import json
import os
from lib.path import APPPATH
from lib.path import APPPICTUREPATH, APPERROR
import threading
import yaml
from lib.logger import logger

class Tool(object):
@property
def app_data(self):
with open(APPPATH, ‘rb‘) as f:
data = yaml.load(f)
return data

def app_error_picture(self):
app_list = os.listdir(APPPICTUREPATH)
app_picture = []
for item in app_list:
if item.endswith(‘.jpg‘):
app_picture.append((APPERROR + item,))
return app_picture

@staticmethod
def app_clear():
app_list = os.listdir(APPPICTUREPATH)
logger.debug(‘上次执行的未删除的图片:%s‘ % app_list)
for p in app_list:
if p.endswith(‘jpg‘) or p.endswith(‘png‘):
os.remove(os.path.join(APPPICTUREPATH, p))

if __name__ == ‘__main__‘:
Tool().app_clear()
网友评论