def __init__(self): self.run = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mail = SendEmail() self.log = UserLog() self.logger = UserLog.get_log()
def watch(self, start_after_seconds=0, interval_seconds=1): if os.path.exists(self._pid_file): with open(self._pid_file, 'r') as f: pid = f.read() if not pid or not psutil.pid_exists(int(pid)): logger.info('Process %s does not exists, remove pid file', pid) os.remove(self._pid_file) else: logger.info('Process %s already exists...', pid) sys.exit(1) signal.signal(signal.SIGTERM, self._sig_exit) signal.signal(signal.SIGINT, self._sig_exit) CommonUtil.set_proctitle('zk-watcher') with open(self._pid_file, 'w') as f: f.write(str(os.getpid())) atexit.register(self.stop) self._watcher = ScheduleTask('ZkWatcher', start_after_seconds, interval_seconds, self._start) self._watcher.run() while not self._stop_flag: try: time.sleep(1) except KeyboardInterrupt: self.stop()
def start(self): try: logger.info('Master process id: %d', os.getpid()) CommonUtil.set_proctitle('master') # 启动工作进程 worker_process = Process(target=self._start) worker_process.start() logger.info('Worker process id: %d, port: %d', worker_process.pid, self._port) self._worker_process = worker_process # kill命令不加参数终止进程 signal.signal(signal.SIGTERM, self._signal_exit) # ctrl + C 终止进程 signal.signal(signal.SIGINT, self._signal_exit) # 段错误,try catch难以捕获此异常 signal.signal(signal.SIGSEGV, self._signal_exit) # zookeeper注册服务 self._register_server() # 工作进程异常退出 worker_process.join() logger.error('Worker process id: %d unexpected exit', worker_process.pid) except Exception as e: # 主进程异常退出 logger.error('Master process id: %d error: %s', os.getpid(), e.message) self._stop(exit_code=1)
def _start_worker_process(self, proc_no): CommonUtil.set_proctitle('sub_process_%s' % proc_no) self._register_harakiri() # 进程结束信号 signal.signal(signal.SIGTERM, self._terminate_handler) while True: fileno = None try: # 从thrift客户端请求队列里取出客户端传送的数据和文件描述符 message, fileno = self._tasks.get() itransport = TTransport.TMemoryBuffer(message) otransport = TTransport.TMemoryBuffer() iprot = self.inputProtocolFactory.getProtocol(itransport) oprot = self.outputProtocolFactory.getProtocol(otransport) if message is None: break with self._harakiri_execute(): # thrift服务端处理请求 self.processor.process(iprot, oprot) # 保存文件描述符对应的客户端连接的响应数据 self._responses[fileno] = (True, otransport.getvalue()) # 将文件描述符以','分隔写入write端 self._write_side.sendall(str(fileno) + ',') except Exception: if fileno: self._responses[fileno] = (False, b'') self._write_side.sendall(str(fileno) + ',')
def __init__(self): """ 初始化RunTest类 """ self.run_method = RunMain() self.data = GetData() self.common_util = CommonUtil() self.send_email = SendEmail()
def __init__(self): self.json_file = "/Users/mac/Desktop/测试资料/蜗牛家产品线/woniujia_cc_jiekou/woniujia_cc_jiekou_git/woniujia_cc_project/dataconfig/request_pram.json" self.sheet_name = "客户模块" self.sheet_id = 5 self.data = GetData(self.json_file, self.sheet_name, self.sheet_id) self.run_method = RunMethod() self.util = CommonUtil() self.email = SendEmail()
def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mai = SendEmail() #不带文件发送 self.send_email = Email() #带文件发送 get_user_log = UserLog() self.logger = get_user_log.get_log()
def __init__(self, json_file, sheet_name, sheet_id): # self.excel_file = excel_file self.json_file = json_file self.sheet_name = sheet_name self.sheet_id = sheet_id self.data = GetData(self.json_file, self.sheet_name) self.run_method = RunMethod() self.util = CommonUtil() self.email = SendEmail()
def __init__(self, json_file, sheet_name, sheet_id, sql_base=None): self.json_file = json_file self.sheet_name = sheet_name self.sheet_id = sheet_id self.sql_base = sql_base self.data = GetData(self.json_file, self.sheet_name) self.run_method = RunMethod() self.util = CommonUtil() self.email = SendEmail()
def get_weather(self, province_en: str, city_en: str): url = "https://tianqi.moji.com/weather/china/%s/%s" % (province_en, city_en) resp = session.get(url, headers=headers) html = resp.text dom = etree.HTML(html) weather_list = dom.xpath("//div[@class='forecast clearfix']/ul[@class='days clearfix'][1]/li//text()") new_arr = CommonUtil.del_empty_str([w.strip() for w in weather_list]) new_arr = CommonUtil.del_empty_str(new_arr) weather_str = "天气 %s,温度:%s,空气质量: %s" % (new_arr[1], new_arr[2], new_arr[5]) return weather_str, url
def run_main(self): case_num = self.data.get_case_num() pass_count = 0 fail_count = 0 for i in range(1, case_num): is_run = self.data.get_is_run(i) if is_run == 'yes': print("----------- ", i) url = self.data.get_url(i) method = self.data.get_method(i) is_cookie = self.data.get_is_cookie(i) depend_case = self.data.get_depend_case(i) depend_field = self.data.get_depend_field(i) depend_key = self.data.get_depend_key(i) request_data = self.data.get_request_data(i) # expect = self.data.get_expect_from_db(i) expect = self.data.get_expect(i) # print(expect) if depend_case != '': print(depend_field, depend_key) new_depend_data = self.depend.get_depend_data( depend_case, depend_field) print(new_depend_data) request_data[depend_key] = new_depend_data cookies = None # 存放cookies if is_cookie == 'yes': cookies = self.operate_cookies.read_cookies() # send = mock.Mock(return_value=expect) # self.send.send_main = send res = self.send.send_main(url, method, request_data, cookies) if is_cookie == 'write': self.operate_cookies.write_cookies(res.json()) # 判断是否包含预期结果 contain = CommonUtil() flag = contain.is_contain(expect, res) if flag: # 执行成功 print('--- 测试通过') self.data.write_data(i, 'pass') pass_count = pass_count + 1 else: print('--- 测试失败') res_str = bytes.decode(res.content) self.data.write_data(i, res_str) fail_count = fail_count + 1 try: res_format = json.dumps(res.json(), ensure_ascii=False, indent=2, sort_keys=True) print(res_format) except: print(res.content)
def south_north_fund(): url = "http://money.finance.sina.com.cn/quotes_service/api/jsonp.php/var%20liveDateTableList=/HK_MoneyFlow.getDayMoneyFlowOtherInfo" headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36' } data = {'ts': 2342354353, '_': CommonUtil.get_timestamp()} resp = requests.get(url, data, headers=headers) html = resp.text live_date_table_list = re.findall("var liveDateTableList=\((.*?)\)", html) live_data = live_date_table_list[0] live_json = jsons.loads(live_data) fund_link = "http://stock.finance.sina.com.cn/hkstock/view/money_flow.php" title = "北上资金:%s 南下资金:%s" % (live_json["north_inFlow_total"], live_json["source_inFlow_total"]) description = "沪股通%s 深股通%s,港股通(沪)%s 港股通(深)%s" % \ (live_json["south_hk_sh"]["daliyInflow"], live_json["south_hk_sz"]["daliyInflow"], live_json["north_sh"]["daliyInflow"], live_json["north_sz"]["daliyInflow"]) log.info(title, description) link_payload = UrlLinkPayload(description=description, title=title, url=fund_link, thumbnailUrl="") url_link = UrlLink(payload=link_payload) return url_link
def derive_state_by_collision_type_state(collision_list_list: list, car_speed_km: float, horizon_length: int): collision_25km_list: list = collision_list_list[ 2] # extract the list that consist of data at 25km flattened_state_list: tuple = numpy.reshape( collision_25km_list, horizon_length * 3) # combine the data lists of each lane into 1 list adjust_to_closest_km: int = None if car_speed_km <= 22.5: adjust_to_closest_km = 20 elif car_speed_km > 22.5 and car_speed_km <= 27.5: adjust_to_closest_km = 25 elif car_speed_km > 27.5: adjust_to_closest_km = 30 else: raise Exception() custom_state_numpy = numpy.append( flattened_state_list, adjust_to_closest_km) # append speed information into list custom_state_tuple = CommonUtil.numpy_list_to_tuple(custom_state_numpy) return custom_state_tuple
class RunTest(object): """这是RunTest""" def __init__(self): self.run_method = RunMethod() self.data = GetData() self.common_util = CommonUtil() self.send_email = SendMail() def go_on_run(self): pass_list = [] fail_list = [] rows_count = self.data.get_case_lines() for i in range(1, rows_count): res = None url = self.data.get_request_url(i) method = self.data.get_request_method(i) is_run = self.data.get_is_run(i) data = self.data.get_request_data_by_json(i) header = self.data.get_header(i) expect_result = self.data.get_expect_result(i) if is_run == "yes": res = self.run_method.run_main(method, url, data, header) if self.common_util.is_contain(expect_result, res): print("用例{}测试通过".format(i)) pass_list.append(i) self.data.write_actual_result(i, 'PASS') else: print("用例{}测试失败".format(i)) fail_list.append(i) self.data.write_actual_result(i, res) print(res) print("=============================") print("{}通过".format(len(pass_list))) print("{}失败".format(len(fail_list))) self.send_email.send_main(pass_list, fail_list)
class RunTest: def __init__(self): """ 初始化RunTest类 """ self.run_method = RunMain() self.data = GetData() self.common_util = CommonUtil() self.send_email = SendEmail() def go_on_run(self): """ 执行测试用例 :return: 通过用例和失败用例 """ pass_list = [] fail_list = [] rows_count = self.data.get_case_num() for i in range(1, rows_count): is_run = self.data.is_run(i) if is_run: url = self.data.get_request_url(i) method = self.data.get_method(i) data = self.data.get_data_for_json(i) cookie = self.data.is_cookie(i) header = self.data.is_header(i) expect = self.data.get_expect_data(i) if isinstance(expect, float): expect = str(int(expect)) depend_case = self.data.is_depend(i) if depend_case is not None: depend_data = DependentData(depend_case) # 获取依赖响应的返回数据 depend_response_data = depend_data.get_data_for_key(i) # # 使用mock-test模拟请求 # depend_response_data = mock_test(self.run_method.run_main, data, url, "POST", order) # 获取依赖的字段 depend_field = self.data.get_depend_field(i) # 更新 data[depend_field] = depend_response_data if cookie == 'write': res = self.run_method.run_main(method, url, data, header) opera_cookie = OperationCookie(res) opera_cookie.write_cookie() elif cookie == 'yes': op_json = OperationJson('../data_config/cookie.json') cookie = op_json.get_data('ASP.NET_SessionId') cookies = {'ASP.NET_SessionId': cookie} res = self.run_method.run_main(method, url, data, cookies) else: res = self.run_method.run_main(method, url, data) if self.common_util.is_contain(expect, res.text): # print("PASS") pass_list.append(i) self.data.write_result(i, 'PASS') else: # print("FAILED") fail_list.append(i) self.data.write_result(i, 'FAILED') self.send_email.send_main(pass_list, fail_list)
def get_south_north_fund() -> Union[str, UrlLink]: # 判断是否是工作日 if CommonUtil.is_holiday(): alert_msg = "今天是非工作日,股票市场不交易" log.info(alert_msg) return alert_msg return south_north_fund()
def __init__(self, methodName='runTest', parame=None): super(ParameTestCase, self).__init__(methodName) self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mai = SendEmail() self.operation = OperetionJson()
class RunTest(object): def __init__(self): self.common_util = CommonUtil() self.send_email = SendEmail() self.connect_db = OperationMySQL() self.run_method = RunMethod() self.op_json = OperationJson() def run(self): res = None pass_count = [] fail_count = [] rows_count = self.connect_db.get_count() print(rows_count) for i in range(0, rows_count): run = self.connect_db.search('run', i) if run: url = self.connect_db.search('url', i) request_method = self.connect_db.search('request_method', i) request_data = self.op_json.get_data( self.connect_db.search('request_data', i)) expect = self.connect_db.search('expect', i) print(expect) res = self.run_method.run_main(request_method, url, request_data) print(res) if self.common_util.is_contain(expect, res) == 1: self.connect_db.write('pass', i + 1) pass_count.append(i + 1) print(pass_count) else: self.connect_db.write(res, i + 1) fail_count.append(i + 1) print(fail_count) self.send_email.send_main(pass_count, fail_count)
class LoginApi: def __init__(self): self.data = GetData( "/Users/mac/Desktop/测试资料/python_jiekou_auto/python_jiekou_git/Demo/dataconfig/login.xls" ) self.run_method = RunMethod() self.util = CommonUtil() def go_run_login(self): # 获取用例行数 row_count = self.data.get_case_line() #循环用例 for i in range(1, row_count): #获取isrun,是否运行该用例 is_run = self.data.get_is_run(i) if is_run: #获取url url = self.data.get_url(i) request_type = self.data.get_request_type(i) header = self.data.get_header(i) request_data = self.data.get_data_for_json(i) response = self.run_method.run_main(request_type, url, request_data, header) print("返回结果:", response) expect_res = self.data.get_except(i) print("期望结果:", expect_res) if self.util.is_contain(expect_res, response): self.data.write_result(i, "测试通过") print("测试通过") else: self.data.write_result(i, "测试失败") print("测试失败") return response
class RunTest(): def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() # 程序执行 def go_on_run(self): rows_count = self.data.get_case_lines() for i in range(1,rows_count): url = self.data.get_request_url(i) method = self.data.get_request_method(i) is_run = self.data.get_is_run(i) data = self.data.get_data_for_json(i) expect = self.data.get_except_data(i) header = self.data.get_is_header(i) if is_run: res = self.run_method.run_main(method,url,data,header) if self.com_util.is_contain(expect,res): print(res) #print("测试通过") #self.data.write_result(i,"pass") else: print(res)
class RunTest: def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() #程序执行的 def go_on_run(self): res = None rows_count = self.data.get_case_lines() for i in range(1, rows_count): is_run = self.data.get_is_run(i) if is_run: url = self.data.get_request_url(i) method = self.data.get_request_method(i) is_run = self.data.get_is_run(i) data = self.data.get_data_for_json(i) header = self.data.is_header(i) expect = self.data.get_expect_data(i) depend_case = self.data.is_depend(i) res = self.run_method.run_main(method, url, data, header) if depend_case != None: self.depend_data = DependdentData() #获取 响应数据 depend_response_data = self.depend_data.get_data_for_key(i) #获取依赖的key depend_key = self.data.get_depend_filed(i) if self.com_util.is_contain(expect, res): self.data.write_result(i, "通过") else: self.data.write_result(i, "失败") print(res)
def compute_features_distance_split(self, query_feature, feature_lib, distance=3): start_time = time.time() query_array = np.array(self.bin_array(query_feature, 64)) split_feature_list = CommonUtil.split_list(feature_lib, 64) distance_list = [] for feature_list in split_feature_list: array_list = [] for f in feature_list: array_list.append(self.bin_array(int(f), 64)) lib_array = np.array(array_list) distance_list = self.compute_features_distance( query_array, lib_array)[0] if (distance_list.size > 0): break duplicate_features = [] for d in distance_list: duplicate_features.append(feature_list[d]) # logger.info('sort distance len:{}, cost time: {}'.format(distance_list.size, (time.time() - start_time))) return duplicate_features
def go_on_run(self): rows_count = GetData().get_case_lines() #获取excel 有数据的行数 # return rows_count for i in range(1, rows_count): # print(i) url = GetData().get_request_url(i) # print(url) method = GetData().get_request_method(i) is_run = GetData().get_is_run(i) data = GetData().get_request_data(i) # 从excel表格中取数据 # print(data) # print(type(data)) expect = GetData().get_expcet_data(i) print(expect) # print(type(expect)) headers = GetData().is_header(i) # print(headers) # print(type(headers)) if is_run: res = RunMethod().run_main(method, url, data, headers) if CommonUtil().is_contain(expect, res): #此处只是一个判断的封装类 # if expect in res: GetData().write_result(i, '测试通过') print('测试通过') # return True #这里放return True 只会执行一次就停止,针对于单个用例的方法判断有效, #for 循环就会失效 所以建议封装一个类 判断放在类中 else: GetData().write_result(i, '测试失败') print('测试失败') # return False # print(type(res)) print(res)
class RunTest: def __init__(self): self.run_method = RunMethod() self.data = GetData() self.common_util = CommonUtil() def go_on_run(self): rows_count = self.data.get_case_line() res_arr = [] for i in range(1, rows_count): # print(i) url = self.data.get_request_url(i).strip() is_run = self.data.get_is_run(i) request_method = self.data.get_request_method(i) header = self.data.is_header(i) request_data = self.data.get_json_data(i) expect_data = self.data.get_expect_value(i) res = None if is_run: res = self.run_method.run_main(request_method, url, header, request_data) if self.common_util.is_contain(expect_data, res): print('测试通过') else: print('测试失败') res_arr.append(res) return res_arr
class RunTest: def __init__(self): self.run_method = RunMethod() self.data = GetData() self.common_util = CommonUtil() self.send_email = SendEmail() def go_on_run(self): res = None pass_count = [] fail_count = [] rows_count = self.data.get_case_lines() for i in range(1, rows_count): url = self.data.get_request_url(i) method = self.data.get_request_method(i) is_run = self.data.get_is_run(i) data = self.data.get_data_for_json(i) expect = self.data.get_expcet_data(i) header = self.data.is_header(i) case_depend = self.data.get_case_depend(i) if case_depend: case_depend = "'" + str(case_depend) + "'" jsontodata = str(data).replace("'@@@'", case_depend) jsontodata = jsontodata.replace("'", '"') data = json.loads(jsontodata) if is_run: res = self.run_method.run_main(method, url, data, header) if self.common_util.is_contain(expect, res): self.data.write_status(i, 'pass') pass_count.append(i) else: self.data.write_status(i, 'fail') fail_count.append(i) self.data.write_res(i, res)
class RunTest(): def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() # 程序执行 def go_on_run(self): res = None rows_count = self.data.get_case_line() for i in range(1, rows_count): is_run = self.data.get_is_run(i) if is_run: url = self.data.get_request_url(i) method = self.data.get_request_method(i) request_data = self.data.get_data_for_json(i) expect = self.data.get_expcet_data(i) header = self.data.is_header(i) depend_case = self.data.is_depend(i) res = self.run_method.run_main(method, url, data, header) if depend_case != None: self.dependent_data = DependdentData() depend_response_data = self.depend_data.get_data_for_key(i) if self.com_util.is_contain(expect, res): self.data.write_result(i, 'pass') else: self.data.write_result(i, 'fail')
def go_on_run(self): rows_count = self.data.get_case_lines() for i in range(1, rows_count): """第一步判断case是否运行""" is_run = self.data.get_is_run(i) # print("run method:%s" % is_run) if is_run: url = self.data.get_url(i) # print(url) method = self.data.get_request_method(i) # print(method) data = self.data.get_data_for_json(i) print(data) header = self.data.is_header(i) expect = self.data.get_expect_data(i) # print(header) """第二步判断是否有依赖""" depend_source_key = GetData().get_depend_source_key(i) if depend_source_key: depend_value = DenpendentData().get_depend_value_from_depend_reponse_data_by_depend_key(i) data[depend_source_key] = depend_value print(data) response = self.run_method.run_main(method, url, data, header) print(response) flag = CommonUtil().contain(expect, response) if flag: self.data.write_result(i, "测试通过") else: self.data.write_result(i, "测试失败")
def reset_screen_state(self, screen_rgb_array): self.processed_screen = CommonUtil.process_screen( screen_rgb_array, self.device) black_screen = torch.zeros_like(self.processed_screen) self.screen_state = black_screen return self.screen_state
class RunTest(): def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mai = SendEmail() #不带文件发送 self.send_email=Email() #带文件发送 get_user_log=UserLog() self.logger = get_user_log.get_log() #程序执行的 def go_on_run(self): res = None pass_count = [] fail_count = [] #10 0,1,2,3 rows_count = self.data.get_case_lines() for i in range(1,rows_count): is_run = self.data.get_is_run(i) if is_run: url = self.data.get_request_url(i) method = self.data.get_request_method(i) request_data = self.data.get_data_for_json(i) expect = self.data.get_expcet_data(i) header = self.data.is_header(i) depend_case = self.data.is_depend(i) case_name=self.data.get_case_name(i) if depend_case != None: self.depend_data = DependdentData(depend_case) #获取的依赖响应数据 depend_response_data = self.depend_data.get_data_for_key(i) #获取依赖的key depend_key = self.data.get_depend_field(i) request_data[depend_key] = depend_response_data if header == 'write': res = self.run_method.run_main(method,url,request_data) op_header = OperationHeader(res) op_header.write_cookie() elif header == 'yes': op_json = OperetionJson('./dataconfig/cookie.json') cookie = op_json.get_data('apsid') # cookies = { # 'apsid':cookie # } res = self.run_method.run_main(method,url,request_data,cookie) self.logger.info("用例名称:"+case_name+"--->返回值:"+res) #print(res) else: res = self.run_method.run_main(method,url,request_data) self.logger.info("用例名称:" + case_name + "--->返回值:" + res) #print(res) if self.com_util.is_contain(expect,res) == True: self.data.write_result(i,'pass') pass_count.append(i) else: self.data.write_result(i,res) fail_count.append(i) self.send_mai.send_main(pass_count,fail_count) #不带文件发送
class RunText: def __init__(self): self.run_method = RunMethod() self.data = GetData() self.common_util = CommonUtil() self.sendmail = SendEmail() # 执行程序的主入口 def go_on_run(self, pr=None): res = None pass_count = [] fail_count = [] row_count = self.data.get_case_lines() for i in range(1, row_count): url = self.data.get_request_url(i) method = self.data.get_request_method(i) data = self.data.get_data_for_json(i) is_run = self.data.get_is_run(i) header = self.data.get_data_header_json(i) expect = self.data.get_expect_data(i) depend_case = self.data.is_depend(i) # if depend_case != None: # self.depend_data = DependdentData(depend_case) # #获取相应数据的依赖 # depend_response_data = self.data.get_depend_key(i) # #获取依赖的key # depend_key = self.data.get_depend_field(i) # data[depend_key] = depend_response_data # res = self.run_method.run_main(method,url,header,data) # print res''' '''if header == 'write': res = self.run_method.run_main(method, url, request_data) op_header = OperationHeader(res) op_header.write_cookie() elif header == 'yes': op_json = OperetionJson('../dataconfig/cookie.json') cookie = op_json.get_data('apsid') cookies = { 'apsid': cookie } res = self.run_method.run_main(method, url, request_data, cookies) else: res = self.run_method.run_main(method, url, request_data)''' if is_run: res = self.run_method.run_main(method, url, header, data) if self.common_util.is_contain(expect, res): # print "测试通过" print self.data.write_value(i, "pass") pass_count.append(i) else: # print "测试失败" print self.data.write_value(i, res) fail_count.append(i) self.sendmail.send_main(pass_count, fail_count)
class RunTest: def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mai = SendEmail() # 程序执行的 def go_on_run(self): res = None pass_count = [] fail_count = [] # 10 0,1,2,3 rows_count = self.data.get_case_lines() for i in range(1, rows_count): is_run = self.data.get_is_run(i) if is_run: url = self.data.get_request_url(i) method = self.data.get_request_method(i) request_data = self.data.get_data_for_json(i) expect = self.data.get_expcet_data_for_mysql(i) header = self.data.is_header(i) depend_case = self.data.is_depend(i) if depend_case != None: self.depend_data = DependdentData(depend_case) # 获取的依赖响应数据 depend_response_data = self.depend_data.get_data_for_key(i) # 获取依赖的key depend_key = self.data.get_depend_field(i) request_data[depend_key] = depend_response_data if header == 'write': res = self.run_method.run_main(method, url, request_data) op_header = OperationHeader(res) op_header.write_cookie() elif header == 'yes': op_json = OperetionJson('../dataconfig/cookie.json') cookie = op_json.get_data('apsid') cookies = { 'apsid': cookie } res = self.run_method.run_main(method, url, request_data, cookies) else: res = self.run_method.run_main(method, url, request_data) if self.com_util.is_equal_dict(expect, res) == 0: self.data.write_result(i, 'pass') pass_count.append(i) else: self.data.write_result(i, res) fail_count.append(i) self.send_mai.send_main(pass_count, fail_count)
def __init__(self): self.run_method = RunMethod() self.data = GetData() self.com_util = CommonUtil() self.send_mai = SendEmail()