• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python log.LOGGER类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中testkitlite.util.log.LOGGER的典型用法代码示例。如果您正苦于以下问题:Python LOGGER类的具体用法?Python LOGGER怎么用?Python LOGGER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了LOGGER类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:31,代码来源:tizenmobile.py


示例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
开发者ID:zqzhang,项目名称:testkit-lite,代码行数:35,代码来源:default.py


示例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
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:26,代码来源:tizenmobile.py


示例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
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:32,代码来源:deepin.py


示例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)
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:9,代码来源:androidunit.py


示例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
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:10,代码来源:windowshttp.py


示例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')
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:10,代码来源:tizenivi.py


示例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
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:11,代码来源:androidmobile.py


示例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
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:11,代码来源:tizenmobile.py


示例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
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:11,代码来源:windowshttp.py


示例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
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:11,代码来源:windowshttp.py


示例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()
开发者ID:zznic,项目名称:testkit-lite,代码行数:12,代码来源:result.py


示例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
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:12,代码来源:windowshttp.py


示例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)
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:12,代码来源:pyunit.py


示例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()
开发者ID:zqzhang,项目名称:testkit-lite,代码行数:13,代码来源:result.py


示例16: kill_testkit_lite

def kill_testkit_lite(pid_file):
    """ kill testkit lite"""
    try:
        with open(pid_file, "r") as pidfile:
            pid = pidfile.readline().rstrip("\n")
            if pid:
                killall(pid)
    except IOError as error:
        pattern = re.compile("No such file or directory|No such process")
        match = pattern.search(str(error))
        if not match:
            LOGGER.info("[ Error: fail to kill existing testkit-lite, " "error: %s ]\n" % error)
    return None
开发者ID:zznic,项目名称:testkit-lite,代码行数:13,代码来源:process.py


示例17: __init__

 def __init__(self, config):
     self.conn = None
     if "commodule" in config:
         try:
             exec "from testkitlite.commodule.%s import get_target_conn" % config[
                 "commodule"]
             device_no = config.get('deviceid', None)
             if device_no is not None:
                 self.conn = get_target_conn(device_no)
             else:
                 self.conn = get_target_conn()
         except Exception as error:
             LOGGER.error("[ Error: Initialize commodule failed: '%s']\n" % error)
开发者ID:zhuyongyong,项目名称:testkit-lite,代码行数:13,代码来源:connector.py


示例18: _nodeunit_test_exec

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)
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:51,代码来源:nodeunit.py


示例19: _iosuiauto_test_exec

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)
开发者ID:JeonghoHan,项目名称:testkit-lite,代码行数:51,代码来源:iosuiauto.py


示例20: _xcunit_test_exec

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)
开发者ID:Shao-Feng,项目名称:testkit-lite,代码行数:49,代码来源:xcunit.py



注:本文中的testkitlite.util.log.LOGGER类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testlib.blockstack_client_initialize_wallet函数代码示例发布时间:2022-05-27
下一篇:
Python autoexec.shell_command函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap