本文整理汇总了Python中testkitlite.util.log.LOGGER.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.debug方法的具体用法?Python LOGGER.debug怎么用?Python LOGGER.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testkitlite.util.log.LOGGER
的用法示例。
在下文中一共展示了LOGGER.debug方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _bdd_test_exec
# 需要导入模块: from testkitlite.util.log import LOGGER [as 别名]
# 或者: from testkitlite.util.log.LOGGER import debug [as 别名]
def _bdd_test_exec(test_session, cases, result_obj, session_dir):
"""function for running bdd tests"""
result_obj.set_status(0)
result_list = []
for i_case in cases['cases']:
i_case_timeout = i_case.get('timeout', DEFAULT_TIMEOUT)
try:
case_entry = i_case['entry']
if not EXISTS(case_entry):
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No such file or dirctory: %s" % case_entry
result_list.append(i_case)
continue
case_id = i_case['case_id']
tmp_result_dir = "%s/%s" % (session_dir, case_id)
os.makedirs(tmp_result_dir)
popen_args = "behave %s --junit --junit-directory %s" % (case_entry, tmp_result_dir)
i_case_proc = subprocess.Popen(args=popen_args, shell=True)
i_case_pre_time = time.time()
while True:
i_case_exit_code = i_case_proc.poll()
i_case_elapsed_time = time.time() - i_case_pre_time
if i_case_exit_code == None:
if i_case_elapsed_time >= i_case_timeout:
tr_utils.KillAllProcesses(ppid=i_case_proc.pid)
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]Timeout"
LOGGER.debug("Run %s timeout" % case_id)
break
elif str(i_case_exit_code) == str(i_case['expected_result']):
i_case['result'] = STR_PASS
i_case['stdout'] = tmp_result_dir
break
else:
i_case['result'] = STR_FAIL
i_case['stdout'] = tmp_result_dir
break
time.sleep(1)
except KeyError:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No 'bdd_test_script_entry' node."
LOGGER.error(
"Run %s: failed: No 'bdd_test_script_entry' node, exit from executer" % case_id)
except Exception, e:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % e
LOGGER.error(
"Run %s: failed: %s, exit from executer" % (case_id, e))
result_list.append(i_case)
示例2: _iosuiauto_test_exec
# 需要导入模块: from testkitlite.util.log import LOGGER [as 别名]
# 或者: from testkitlite.util.log.LOGGER import debug [as 别名]
def _iosuiauto_test_exec(test_session, cases, result_obj, session_dir):
"""function for running iosuiauto tests"""
result_obj.set_status(0)
result_list = []
for i_case in cases['cases']:
i_case_timeout = i_case.get('timeout', DEFAULT_TIMEOUT)
try:
case_entry = i_case['entry']
expected_result = int(i_case['expected_result'])
if not EXISTS(case_entry):
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No such file or dirctory: %s" % case_entry
result_list.append(i_case)
continue
case_id = i_case['case_id']
destination = "platform=%s,name=%s" % (os.environ["IOS_PLATFORM"], os.environ["IOS_NAME"])
if os.environ.get("IOS_VERSION", None):
destination = "%s,OS=%s" % (destination, os.environ["IOS_VERSION"])
device_id = os.environ["DEVICE_ID"]
popen_args = 'python %s -d "%s" -u "%s"' % (case_entry, destination, device_id)
i_case_proc = subprocess.Popen(args=popen_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
i_case_pre_time = time.time()
while True:
output_infos = i_case_proc.communicate()
i_case_exit_code = i_case_proc.returncode
i_case_elapsed_time = time.time() - i_case_pre_time
if i_case_exit_code == None:
if i_case_elapsed_time >= i_case_timeout:
tr_utils.KillAllProcesses(ppid=i_case_proc.pid)
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]Timeout"
LOGGER.debug("Run %s timeout" % case_id)
result_list.append(i_case)
break
else:
if i_case_exit_code == expected_result:
i_case['result'] = STR_PASS
i_case['stdout'] = "[Message]" + output_infos[0].replace("\n", "\r")
else:
i_case['result'] = STR_FAIL
i_case['stderr'] = output_infos[1].replace("\n", "\r")
result_list.append(i_case)
break
time.sleep(1)
except Exception, e:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % e
LOGGER.error(
"Run %s: failed: %s, exit from executer" % (case_id, e))
result_list.append(i_case)
示例3: _nodeunit_test_exec
# 需要导入模块: from testkitlite.util.log import LOGGER [as 别名]
# 或者: from testkitlite.util.log.LOGGER import debug [as 别名]
def _nodeunit_test_exec(test_session, cases, result_obj, session_dir):
"""function for running nodeunit tests"""
result_obj.set_status(0)
result_list = []
for i_case in cases['cases']:
i_case_timeout = i_case.get('timeout', DEFAULT_TIMEOUT)
try:
case_entry = i_case['entry']
if not EXISTS(case_entry):
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No such file or dirctory: %s" % case_entry
result_list.append(i_case)
continue
case_id = i_case['case_id']
tmp_result_dir = "%s/%s" % (session_dir, case_id)
os.makedirs(tmp_result_dir)
popen_args = "nodeunit %s --reporter junit --output %s" % (case_entry, tmp_result_dir)
i_case_proc = subprocess.Popen(args=popen_args, shell=True, stderr=subprocess.PIPE)
i_case_pre_time = time.time()
while True:
i_case_exit_code = i_case_proc.poll()
i_case_elapsed_time = time.time() - i_case_pre_time
if i_case_exit_code == None:
if i_case_elapsed_time >= i_case_timeout:
tr_utils.KillAllProcesses(ppid=i_case_proc.pid)
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]Timeout"
LOGGER.debug("Run %s timeout" % case_id)
break
else:
if int(i_case_exit_code) == 0:
i_case['result'] = STR_PASS
i_case['stdout'] = tmp_result_dir
elif int(i_case_exit_code) == 1:
i_case['result'] = STR_FAIL
i_case['stdout'] = tmp_result_dir
else:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % ''.join(i_case_proc.stderr.readlines()).strip('\n')
break
time.sleep(1)
except Exception, e:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % e
LOGGER.error(
"Run %s: failed: %s, exit from executer" % (case_id, e))
result_list.append(i_case)
示例4: _xcunit_test_exec
# 需要导入模块: from testkitlite.util.log import LOGGER [as 别名]
# 或者: from testkitlite.util.log.LOGGER import debug [as 别名]
def _xcunit_test_exec(test_session, cases, result_obj, session_dir):
"""function for running xcunit tests"""
result_obj.set_status(0)
result_list = []
for i_case in cases['cases']:
i_case_timeout = i_case.get('timeout', DEFAULT_TIMEOUT)
try:
case_entry = i_case['entry']
if not EXISTS(case_entry):
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No such file or dirctory: %s" % case_entry
result_list.append(i_case)
continue
case_id = i_case['case_id']
destination = "platform=%s,name=%s" % (os.environ["IOS_PLATFORM"], os.environ["IOS_NAME"])
if os.environ.get("IOS_VERSION", None):
destination = "%s,OS=%s" % (destination, os.environ["IOS_VERSION"])
popen_args = 'python %s -d "%s"' % (case_entry, destination)
i_case_proc = subprocess.Popen(args=popen_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
i_case_pre_time = time.time()
while True:
output_infos = i_case_proc.communicate()
i_case_exit_code = i_case_proc.returncode
i_case_elapsed_time = time.time() - i_case_pre_time
if i_case_exit_code == None:
if i_case_elapsed_time >= i_case_timeout:
tr_utils.KillAllProcesses(ppid=i_case_proc.pid)
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]Timeout"
LOGGER.debug("Run %s timeout" % case_id)
result_list.append(i_case)
break
else:
for line in output_infos[0].split('\n'):
result_dic = {}
if line.startswith("Test Case '-["):
if line.find("seconds") != -1:
info_list = line.split(' ')
result_dic['case_id'] = "%s/%s" % (info_list[2][3:], info_list[3][:-2])
result_dic['result'] = {"passed": STR_PASS, "failed": STR_FAIL}[info_list[4]]
result_list.append(result_dic)
break
time.sleep(1)
except Exception, e:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % e
LOGGER.error(
"Run %s: failed: %s, exit from executer" % (case_id, e))
result_list.append(i_case)
示例5: _mocha_test_exec
# 需要导入模块: from testkitlite.util.log import LOGGER [as 别名]
# 或者: from testkitlite.util.log.LOGGER import debug [as 别名]
def _mocha_test_exec(test_session, cases, result_obj, session_dir):
"""function for running mocha tests"""
result_obj.set_status(0)
result_list = []
for i_case in cases['cases']:
i_case_timeout = i_case.get('timeout', DEFAULT_TIMEOUT)
try:
case_entry = i_case['entry']
status, output = commands.getstatusoutput("ssh %s 'ls %s'" % (os.environ["DEVICE_ID"], case_entry))
if status != 0:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]No such file or dirctory: %s" % case_entry
result_list.append(i_case)
continue
case_id = i_case['case_id']
tmp_result_dir = "%s/json_results" % session_dir
os.makedirs(tmp_result_dir)
popen_args = "ssh %s 'mocha %s --reporter json' > %s/%s.json" % (os.environ["DEVICE_ID"], case_entry, tmp_result_dir, case_id)
i_case_proc = subprocess.Popen(args=popen_args, shell=True)
i_case_pre_time = time.time()
while True:
i_case_exit_code = i_case_proc.poll()
i_case_elapsed_time = time.time() - i_case_pre_time
if i_case_exit_code == None:
if i_case_elapsed_time >= i_case_timeout:
tr_utils.KillAllProcesses(ppid=i_case_proc.pid)
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]Timeout"
LOGGER.debug("Run %s timeout" % case_id)
break
else:
i_case['result'] = STR_FAIL
i_case['stdout'] = tmp_result_dir
break
time.sleep(1)
except Exception, e:
i_case['result'] = STR_BLOCK
i_case['stdout'] = "[Message]%s" % e
LOGGER.error(
"Run %s: failed: %s, exit from executer" % (case_id, e))
result_list.append(i_case)