本文整理汇总了Python中testkitlite.util.log.LOGGER类的典型用法代码示例。如果您正苦于以下问题:Python LOGGER类的具体用法?Python LOGGER怎么用?Python LOGGER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LOGGER类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_wrt_app
def _get_wrt_app(self, test_suite, test_set, fuzzy_match, auto_iu):
test_app_id = None
if auto_iu:
test_wgt = test_set
test_wgt_path = WRT_LOCATION % (test_suite, test_wgt)
if not self.install_app(test_wgt_path):
LOGGER.info("[ failed to install widget \"%s\" in target ]"
% test_wgt)
return None
else:
test_wgt = test_suite
# check if widget installed already
cmd = WRT_QUERY_STR % (self.deviceid, test_wgt)
exit_code, ret = shell_command(cmd)
if exit_code == -1:
return None
for line in ret:
items = line.split(':')
if len(items) < 1:
continue
if (fuzzy_match and items[0].find(test_wgt) != -1) or items[0] == test_wgt:
test_app_id = items[1].strip('\r\n')
break
if test_app_id is None:
LOGGER.info("[ test widget \"%s\" not found in target ]"
% test_wgt)
return None
return test_app_id
示例2: run_test
def run_test(self, sessionid, test_set):
"""
process the execution for a test set
"""
if sessionid is None:
return False
if not "cases" in test_set:
return False
disabledlog = os.environ.get('disabledlog','')
cases, exetype, ctype = test_set[
"cases"], test_set["exetype"], test_set["type"]
#print 'exetype', exetype
if len(cases) == 0:
return False
# start debug trace thread
if disabledlog == 'True':
pass
else:
self.conn.start_debug(self.opts['debug_log_base'])
time.sleep(1)
self.result_obj = TestSetResut(
self.opts['testsuite_name'], self.opts['testset_name'])
if self.opts['test_type'] == "webapi":
if ctype == 'ref':
exetype = 'manual'
return self.__run_web_test(sessionid, self.opts['testset_name'], exetype, ctype, cases)
elif self.opts['test_type'] == "coreapi":
return self.__run_core_test(sessionid, self.opts['testset_name'], exetype, cases)
#elif self.opts['test_type'] == "jqunit":
elif self.opts['test_type'] in ["jqunit",'pyunit']:
return self.__run_jqt_test(sessionid, self.opts['testset_name'], cases)
else:
LOGGER.info("[ unsupported test suite type ! ]")
return False
示例3: _get_xwalk_app
def _get_xwalk_app(self, test_suite, test_set, fuzzy_match, auto_iu):
test_app_id = None
if auto_iu:
test_wgt = test_set
test_wgt_path = XWALK_LOCATION % (test_suite, test_wgt)
if not self.install_app(test_wgt_path):
LOGGER.info("[ failed to install widget \"%s\" in target ]"
% test_wgt)
return None
else:
test_wgt = test_suite
# check if widget installed already
cmd = XWALK_QUERY_STR % (self.deviceid, test_wgt)
exit_code, ret = shell_command(cmd)
if exit_code == -1:
return None
for line in ret:
test_app_id = line.strip('\r\n')
if test_app_id is None:
LOGGER.info("[ test widget \"%s\" not found in target ]"
% test_wgt)
return None
return test_app_id
示例4: _get_xwalk_app
def _get_xwalk_app(self, test_suite, test_set, fuzzy_match, auto_iu):
test_app_id = ""
if auto_iu:
test_wgt = test_set
test_wgt_path = XWALK_LOCATION % (DEEPIN_USER, test_suite, test_wgt)
if not self.install_app(test_wgt_path):
LOGGER.info("[ failed to install widget \"%s\" in target ]"
% test_wgt)
return None
else:
test_wgt = test_suite
arr = test_wgt.split('-')
for item in arr:
test_app_id += item
test_wgt = test_app_id
# check if widget installed already
cmd = XWALK_QUERY_STR % (test_wgt)
exit_code, ret = shell_command(cmd)
if exit_code == -1:
return None
# for line in ret:
# test_app_id = line.strip('\r\n')
if test_app_id is None:
LOGGER.info("[ test widget \"%s\" not found in target ]"
% test_wgt)
return None
return test_app_id
示例5: _adunit_test_exec
def _adunit_test_exec(conn, test_session, test_set_path, result_obj):
"""function for running core tests"""
global result_buffer
result_buffer = result_obj
result_obj.set_status(0)
LOGGER.info('[ android unit test, entry: %s ]' % test_set_path)
test_cmd = ANDROID_UNIT_START % (test_set_path, '.'.join(test_set_path.split('.')[:-1]))
_code, _out, _error = conn.shell_cmd_ext(cmd=test_cmd, timeout=None, boutput=True, callbk=_adunit_lines_handler)
result_obj.set_status(1)
示例6: get_launcher_opt
def get_launcher_opt(self, test_launcher, test_ext, test_widget, test_suite, test_set):
"""
get test option dict
"""
test_opt = {}
test_opt["launcher"] = WIN_MAIN
LOGGER.info("[ test_ext: %s; test_widget: %s; test_suite: %s]" % (test_ext, test_widget, test_suite))
test_opt["test_app_id"] = test_suite
return test_opt
示例7: _get_user_id
def _get_user_id(self):
if TIZEN_USER.lower() == 'app':
self.port = '5000'
else:
cmdline = XWALK_QUERY_ID % (self.deviceid, TIZEN_USER)
exit_code, ret = shell_command(cmdline)
if exit_code == -1:
LOGGER.info("[ can not get user id ]")
if len(ret) > 0 :
self.port = ret[0].strip('\r\n')
示例8: download_file
def download_file(self, remote_path, local_path):
"""download file from device"""
cmd = "adb -s %s pull %s %s" % (self.deviceid, remote_path, local_path)
exit_code, ret = shell_command(cmd)
if exit_code != 0:
error = ret[0].strip('\r\n') if len(ret) else "sdb shell timeout"
LOGGER.info("[ Download file \"%s\" failed, error: %s ]"
% (remote_path, error))
return False
else:
return True
示例9: upload_file
def upload_file(self, remote_path, local_path):
"""upload file to device"""
cmd = "sdb -s %s push %s %s" % (self.deviceid, local_path, remote_path)
exit_code, ret = shell_command(cmd)
if exit_code != 0:
error = ret[0].strip('\r\n') if len(ret) else "sdb shell timeout"
LOGGER.info("[ Upload file \"%s\" failed,"
" get error: %s ]" % (local_path, error))
return False
else:
return True
示例10: kill_stub
def kill_stub(self):
stub_status = False
server_url = "http://%s:9000" % self.deviceip
ret = http_request(
get_url(server_url, "/kill_stub"), "GET", {})
if ret is None:
LOGGER.error("[ ERROR: get server status timeout, please check deivce! ]")
else:
if ret.get("OK") is not None:
stub_status = True
return stub_status
示例11: launch_stub
def launch_stub(self, stub_app, stub_port="8000", debug_opt=""):
stub_status = False
server_url = "http://%s:9000" % self.deviceip
ret = http_request(
get_url(server_url, "/launch_stub"), "GET", {})
if ret is None:
LOGGER.error("[ ERROR: get server status timeout, please check deivce! ]")
else:
if ret.get("OK") is not None:
stub_status = True
return stub_status
示例12: extend_result
def extend_result(self, cases_result=None, print_out=True):
"""update cases result to the result buffer"""
self._mutex.acquire()
if cases_result is not None:
self._result["cases"].extend(cases_result)
if print_out:
for case_it in cases_result:
LOGGER.info(self._progress % (self._suite_name, case_it["case_id"], case_it["result"]))
if case_it["result"].lower() in ["fail", "block"] and "stdout" in case_it:
LOGGER.info(str2str(case_it["stdout"]))
self._mutex.release()
示例13: check_process
def check_process(self, process_name):
stub_status = 0
server_url = "http://%s:9000" % self.deviceip
LOGGER.error("[ Server URL: %s]" % server_url)
ret = http_request(
get_url(server_url, "/check_stub"), "GET", {})
if ret is None:
LOGGER.error("[ ERROR: get server status timeout, please check deivce! ]")
else:
if ret.get("OK") is not None:
stub_status = 1
return stub_status
示例14: _pyunit_test_exec
def _pyunit_test_exec(test_session, test_set_path, result_obj):
"""function for running core tests"""
global result_buffer
result_buffer = result_obj
result_obj.set_status(0)
LOGGER.info('[ pyunit test: %s ]' % test_set_path)
try:
tests = unittest.TestLoader().discover(test_set_path, pattern='*test*.py')
unittest.TextTestRunner(resultclass=LiteTestResult, buffer=True).run(tests)
except ImportError as error:
pass
result_obj.set_status(1)
示例15: extend_result
def extend_result(self, cases_result=None, print_out=True):
"""update cases result to the result buffer"""
self._mutex.acquire()
if cases_result is not None:
self._result["cases"].extend(cases_result)
if print_out:
for case_it in cases_result:
LOGGER.info(self._progress %
(self._suite_name, case_it['case_id'], case_it['result']))
if case_it['result'].lower() in ['fail', 'block'] and 'stdout' in case_it:
LOGGER.info(str2str(case_it['stdout']))
self._mutex.release()