当前位置: 首页>>代码示例>>Python>>正文


Python LOG_UI.error方法代码示例

本文整理汇总了Python中avocado.core.output.LOG_UI.error方法的典型用法代码示例。如果您正苦于以下问题:Python LOG_UI.error方法的具体用法?Python LOG_UI.error怎么用?Python LOG_UI.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在avocado.core.output.LOG_UI的用法示例。


在下文中一共展示了LOG_UI.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def run(self, args):
        if args.distro_def_create:
            if not (args.distro_def_name and args.distro_def_version and
                    args.distro_def_arch and args.distro_def_type and
                    args.distro_def_path):
                LOG_UI.error('Required arguments: name, version, arch, type '
                             'and path')
                sys.exit(exit_codes.AVOCADO_FAIL)

            output_file_name = self.get_output_file_name(args)
            if os.path.exists(output_file_name):
                error_msg = ('Output file "%s" already exists, will not '
                             'overwrite it', output_file_name)
                LOG_UI.error(error_msg)
            else:
                LOG_UI.debug("Loading distro information from tree... "
                             "Please wait...")
                distro = load_from_tree(args.distro_def_name,
                                        args.distro_def_version,
                                        args.distro_def_release,
                                        args.distro_def_arch,
                                        args.distro_def_type,
                                        args.distro_def_path)
                save_distro(distro, output_file_name)
                LOG_UI.debug('Distro information saved to "%s"',
                             output_file_name)
        else:
            detected = utils_distro.detect()
            LOG_UI.debug('Detected distribution: %s (%s) version %s release '
                         '%s', detected.name, detected.arch, detected.version,
                         detected.release)
开发者ID:EIChaoYang,项目名称:avocado,代码行数:33,代码来源:distro.py

示例2: run

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def run(self, args):
        LOG_UI.info('Config files read (in order):')
        for cfg_path in settings.config_paths:
            LOG_UI.debug('    %s' % cfg_path)
        if settings.config_paths_failed:
            LOG_UI.error('\nConfig files that failed to read:')
            for cfg_path in settings.config_paths_failed:
                LOG_UI.error('    %s' % cfg_path)
        LOG_UI.debug("")
        if not args.datadir:
            blength = 0
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    clength = len('%s.%s' % (section, value[0]))
                    if clength > blength:
                        blength = clength

            format_str = "    %-" + str(blength) + "s %s"

            LOG_UI.debug(format_str, 'Section.Key', 'Value')
            for section in settings.config.sections():
                for value in settings.config.items(section):
                    config_key = ".".join((section, value[0]))
                    LOG_UI.debug(format_str, config_key, value[1])
        else:
            LOG_UI.debug("Avocado replaces config dirs that can't be accessed")
            LOG_UI.debug("with sensible defaults. Please edit your local config")
            LOG_UI.debug("file to customize values")
            LOG_UI.debug('')
            LOG_UI.info('Avocado Data Directories:')
            LOG_UI.debug('    base     ' + data_dir.get_base_dir())
            LOG_UI.debug('    tests    ' + data_dir.get_test_dir())
            LOG_UI.debug('    data     ' + data_dir.get_data_dir())
            LOG_UI.debug('    logs     ' + data_dir.get_logs_dir())
            LOG_UI.debug('    cache    ' + ", ".join(data_dir.get_cache_dirs()))
开发者ID:balamuruhans,项目名称:avocado,代码行数:37,代码来源:config.py

示例3: initialize

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def initialize(self, args):
        self.variants = None

        cit_parameter_file = getattr(args, "cit_parameter_file", None)
        if cit_parameter_file is None:
            return
        else:
            cit_parameter_file = os.path.expanduser(cit_parameter_file)
            if not os.access(cit_parameter_file, os.R_OK):
                LOG_UI.error("parameter file '%s' could not be found or "
                             "is not readable", cit_parameter_file)
                self.error_exit(args)

        config = configparser.ConfigParser()
        try:
            config.read(cit_parameter_file)
        except Exception as details:
            LOG_UI.error("Cannot parse parameter file: %s", details)
            self.error_exit(args)

        parameters = [(key, value.split(', '))
                      for key, value in config.items('parameters')]
        order = args.cit_order_of_combinations
        cit = Cit(parameters, order)
        self.headers, self.variants = cit.combine()
开发者ID:clebergnu,项目名称:avocado,代码行数:27,代码来源:__init__.py

示例4: _get_test_suite

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
 def _get_test_suite(self, paths):
     if self.args.verbose:
         which_tests = loader.DiscoverMode.ALL
     else:
         which_tests = loader.DiscoverMode.AVAILABLE
     try:
         return loader.loader.discover(paths,
                                       which_tests=which_tests)
     except loader.LoaderUnhandledReferenceError as details:
         LOG_UI.error(str(details))
         sys.exit(exit_codes.AVOCADO_FAIL)
开发者ID:clebergnu,项目名称:avocado,代码行数:13,代码来源:list.py

示例5: initialize

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def initialize(self, args):
        load_variants = getattr(args, "json_variants_load", None)

        if load_variants is None:
            self.variants = _NO_VARIANTS
            return
        try:
            with open(load_variants, 'r') as var_file:
                self.variants = varianter.Varianter(state=json.load(var_file))
        except IOError:
            LOG_UI.error("JSON serialized file '%s' could not be found or "
                         "is not readable", load_variants)
            if args.subcommand == 'run':
                sys.exit(exit_codes.AVOCADO_JOB_FAIL)
            else:
                sys.exit(exit_codes.AVOCADO_FAIL)
开发者ID:avocado-framework,项目名称:avocado,代码行数:18,代码来源:json_variants.py

示例6: mail

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def mail(self, job):
        # build proper subject based on job status
        subject = '%s Job %s - Status: %s' % (self.subject,
                                              job.unique_id,
                                              job.status)
        msg = MIMEText(subject)
        msg['Subject'] = self.subject
        msg['From'] = self.sender
        msg['To'] = self.rcpt

        # So many possible failures, let's just tell the user about it
        try:
            smtp = smtplib.SMTP(self.server)
            smtp.sendmail(self.sender, [self.rcpt], msg.as_string())
            smtp.quit()
        except:
            LOG_UI.error("Failure to send email notification: "
                         "please check your mail configuration")
开发者ID:EIChaoYang,项目名称:avocado,代码行数:20,代码来源:avocado_job_mail.py

示例7: _check_required_args

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def _check_required_args(args, enable_arg, required_args):
        """
        :return: True when enable_arg enabled and all required args are set
        :raise sys.exit: When missing required argument.
        """
        if (not hasattr(args, enable_arg) or
                not getattr(args, enable_arg)):
            return False
        missing = []
        for arg in required_args:
            if not getattr(args, arg):
                missing.append(arg)
        if missing:
            LOG_UI.error("Use of %s requires %s arguments to be set. Please "
                         "set %s.", enable_arg, ', '.join(required_args),
                         ', '.join(missing))

            return sys.exit(exit_codes.AVOCADO_FAIL)
        return True
开发者ID:jcfaracco,项目名称:avocado,代码行数:21,代码来源:__init__.py

示例8: run

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def run(self, args):
        """
        Run test modules or simple tests.

        :param args: Command line args received from the run subparser.
        """
        if 'output_check_record' in args:
            process.OUTPUT_CHECK_RECORD_MODE = getattr(args,
                                                       'output_check_record',
                                                       None)

        if args.unique_job_id is not None:
            try:
                int(args.unique_job_id, 16)
                if len(args.unique_job_id) != 40:
                    raise ValueError
            except ValueError:
                LOG_UI.error('Unique Job ID needs to be a 40 digit hex number')
                sys.exit(exit_codes.AVOCADO_FAIL)
        try:
            args.job_timeout = time_to_seconds(args.job_timeout)
        except ValueError as detail:
            LOG_UI.error(detail.args[0])
            sys.exit(exit_codes.AVOCADO_FAIL)
        with job.Job(args) as job_instance:
            pre_post_dispatcher = JobPrePostDispatcher()
            try:
                # Run JobPre plugins
                output.log_plugin_failures(pre_post_dispatcher.load_failures)
                pre_post_dispatcher.map_method('pre', job_instance)

                job_run = job_instance.run()
            finally:
                # Run JobPost plugins
                pre_post_dispatcher.map_method('post', job_instance)

            result_dispatcher = ResultDispatcher()
            if result_dispatcher.extensions:
                result_dispatcher.map_method('render',
                                             job_instance.result,
                                             job_instance)
        return job_run
开发者ID:avocado-framework,项目名称:avocado,代码行数:44,代码来源:run.py

示例9: _run_scripts

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def _run_scripts(self, kind, scripts_dir, job):
        if not os.path.isdir(scripts_dir):
            if self.warn_non_existing_dir:
                LOG_UI.error("Directory configured to hold %s-job scripts "
                             "has not been found: %s", kind, scripts_dir)
            return

        dir_list = os.listdir(scripts_dir)
        scripts = [os.path.join(scripts_dir, f) for f in dir_list]
        scripts = [f for f in scripts
                   if os.access(f, os.R_OK | os.X_OK)]
        scripts.sort()
        if not scripts:
            return

        env = self._job_to_environment_variables(job)
        for script in scripts:
            result = process.run(script, ignore_status=True, env=env)
            if (result.exit_status != 0) and self.warn_non_zero_status:
                LOG_UI.error('%s job script "%s" exited with status "%i"',
                             kind.capitalize(), script, result.exit_status)
开发者ID:EIChaoYang,项目名称:avocado,代码行数:23,代码来源:jobscripts.py

示例10: _setup_job

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def _setup_job(job_id):
        if os.path.isdir(job_id):
            resultsdir = os.path.expanduser(job_id)
            job_id = ''
        elif os.path.isfile(job_id):
            resultsdir = os.path.dirname(os.path.expanduser(job_id))
            job_id = ''
        else:
            logdir = settings.get_value(section='datadir.paths',
                                        key='logs_dir', key_type='path',
                                        default=None)
            try:
                resultsdir = jobdata.get_resultsdir(logdir, job_id)
            except ValueError as exception:
                LOG_UI.error(exception)
                sys.exit(exit_codes.AVOCADO_FAIL)

        if resultsdir is None:
            LOG_UI.error("Can't find job results directory for '%s' in '%s'",
                         job_id, logdir)
            sys.exit(exit_codes.AVOCADO_FAIL)

        sourcejob = jobdata.get_id(os.path.join(resultsdir, 'id'), job_id)
        if sourcejob is None:
            LOG_UI.error("Can't find matching job id '%s' in '%s' directory.",
                         job_id, resultsdir)
            sys.exit(exit_codes.AVOCADO_FAIL)

        return resultsdir, sourcejob
开发者ID:avocado-framework,项目名称:avocado,代码行数:31,代码来源:diff.py

示例11: run

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def run(self, args):
        err = None
        if args.tree and args.varianter_debug:
            err = "Option --tree is incompatible with --debug."
        elif not args.tree and args.inherit:
            err = "Option --inherit can be only used with --tree"
        if err:
            LOG_UI.error(err)
            sys.exit(exit_codes.AVOCADO_FAIL)
        varianter = args.avocado_variants
        try:
            varianter.parse(args)
        except (IOError, ValueError) as details:
            LOG_UI.error("Unable to parse varianter: %s", details)
            sys.exit(exit_codes.AVOCADO_FAIL)
        use_utf8 = settings.get_value("runner.output", "utf8",
                                      key_type=bool, default=None)
        summary = args.summary or 0
        variants = args.variants or 0

        # Parse obsolete options (unsafe to combine them with new args)
        if args.tree:
            variants = 0
            summary += 1
            if args.contents:
                summary += 1
            if args.inherit:
                summary += 2
        else:
            if args.contents:
                variants += 2

        # Produce the output
        lines = args.avocado_variants.to_str(summary=summary,
                                             variants=variants,
                                             use_utf8=use_utf8)
        for line in lines.splitlines():
            LOG_UI.debug(line)

        sys.exit(exit_codes.AVOCADO_ALL_OK)
开发者ID:vivianQizhu,项目名称:avocado,代码行数:42,代码来源:variants.py

示例12: initialize

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def initialize(self, args):
        debug = getattr(args, "varianter_debug", False)

        if debug:
            data = mux.MuxTreeNodeDebug()
        else:
            data = mux.MuxTreeNode()

        # Merge the multiplex
        multiplex_files = getattr(args, "mux_yaml", None)
        if multiplex_files:
            try:
                data.merge(create_from_yaml(multiplex_files, debug))
            except IOError as details:
                error_msg = "%s : %s" % (details.strerror, details.filename)
                LOG_UI.error(error_msg)
                if args.subcommand == 'run':
                    sys.exit(exit_codes.AVOCADO_JOB_FAIL)
                else:
                    sys.exit(exit_codes.AVOCADO_FAIL)

        # Extend default multiplex tree of --mux-inject values
        for inject in getattr(args, "mux_inject", []):
            entry = inject.split(':', 3)
            if len(entry) < 2:
                raise ValueError("key:entry pairs required, found only %s"
                                 % (entry))
            elif len(entry) == 2:   # key, entry
                entry.insert(0, '')  # add path='' (root)
            data.get_node(entry[0], True).value[entry[1]] = entry[2]

        mux_filter_only = getattr(args, 'mux_filter_only', None)
        mux_filter_out = getattr(args, 'mux_filter_out', None)
        data = mux.apply_filters(data, mux_filter_only, mux_filter_out)
        if data != mux.MuxTreeNode():
            paths = getattr(args, "mux_parameter_paths", ["/run/*"])
            if paths is None:
                paths = ["/run/*"]
            self.initialize_mux(data, paths, debug)
开发者ID:dzhengfy,项目名称:avocado,代码行数:41,代码来源:__init__.py

示例13: run

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def run(self, args):
        """
        Print libexec path and finish

        :param args: Command line args received from the run subparser.
        """
        if 'VIRTUAL_ENV' in os.environ:
            LOG_UI.debug('libexec')
        elif os.path.exists('/usr/libexec/avocado'):
            LOG_UI.debug('/usr/libexec/avocado')
        elif os.path.exists('/usr/lib/avocado'):
            LOG_UI.debug('/usr/lib/avocado')
        else:
            for path in os.environ.get('PATH').split(':'):
                if (os.path.exists(os.path.join(path, 'avocado')) and
                    os.path.exists(os.path.join(os.path.dirname(path),
                                                'libexec'))):
                    LOG_UI.debug(os.path.join(os.path.dirname(path), 'libexec'))
                    break
            else:
                LOG_UI.error("Can't locate avocado libexec path")
                sys.exit(exit_codes.AVOCADO_FAIL)
        return sys.exit(exit_codes.AVOCADO_ALL_OK)
开发者ID:EIChaoYang,项目名称:avocado,代码行数:25,代码来源:exec_path.py

示例14: initialize

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
    def initialize(self, args):
        self.variants = None
        error = False

        pict_parameter_file = getattr(args, "pict_parameter_file", None)
        if pict_parameter_file is None:
            return
        else:
            pict_parameter_file = os.path.expanduser(pict_parameter_file)
            if not os.access(pict_parameter_file, os.R_OK):
                LOG_UI.error("pict parameter file '%s' could not be found or "
                             "is not readable", pict_parameter_file)
                error = True

        pict_binary = getattr(args, "pict_binary", None)
        if pict_binary is None:
            LOG_UI.error("pict binary could not be found in $PATH. Please set "
                         "its location with --pict-binary or put it in your "
                         "$PATH")
            error = True
        else:
            pict_binary = os.path.expanduser(pict_binary)
            if not os.access(pict_binary, os.R_OK | os.X_OK):
                LOG_UI.error("pict binary '%s' can not be executed, please check "
                             "the option given with --pict-binary and/or the file "
                             "permissions", pict_binary)
                error = True

        if error:
            if args.subcommand == 'run':
                sys.exit(exit_codes.AVOCADO_JOB_FAIL)
            else:
                sys.exit(exit_codes.AVOCADO_FAIL)

        self.parameter_path = getattr(args, "pict_parameter_path")

        output = run_pict(pict_binary,
                          pict_parameter_file,
                          getattr(args, "pict_order_of_combinations"))
        self.headers, self.variants = parse_pict_output(output)
开发者ID:avocado-framework,项目名称:avocado,代码行数:42,代码来源:__init__.py

示例15: list

# 需要导入模块: from avocado.core.output import LOG_UI [as 别名]
# 或者: from avocado.core.output.LOG_UI import error [as 别名]
 def list(self):
     try:
         self._list()
     except KeyboardInterrupt:
         LOG_UI.error('Command interrupted by user...')
         return exit_codes.AVOCADO_FAIL
开发者ID:clebergnu,项目名称:avocado,代码行数:8,代码来源:list.py


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