コード例 #1
0
ファイル: list.py プロジェクト: leewishyuanfang/avocado
    def _display(self, suite, matrix, resolution=None):
        header = None
        verbose = suite.config.get('core.verbose')
        if verbose:
            header = (TERM_SUPPORT.header_str('Type'),
                      TERM_SUPPORT.header_str('Test'),
                      TERM_SUPPORT.header_str('Tag(s)'))

        for line in iter_tabular_output(matrix, header=header, strip=True):
            LOG_UI.debug(line)

        if verbose:
            LOG_UI.info("")
            LOG_UI.info("TEST TYPES SUMMARY")
            LOG_UI.info("==================")
            for key in sorted(suite.stats):
                LOG_UI.info("%s: %s", key, suite.stats[key])

            if suite.tags_stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TAGS SUMMARY")
                LOG_UI.info("=================")
                for key in sorted(suite.tags_stats):
                    LOG_UI.info("%s: %s", key, suite.tags_stats[key])

            if resolution:
                resolution_header = (TERM_SUPPORT.header_str('Resolver'),
                                     TERM_SUPPORT.header_str('Reference'),
                                     TERM_SUPPORT.header_str('Info'))
                LOG_UI.info("")
                for line in iter_tabular_output(resolution,
                                                header=resolution_header,
                                                strip=True):
                    LOG_UI.info(line)
コード例 #2
0
ファイル: list.py プロジェクト: zhijianli88/avocado
    def _display(self, suite, matrix):
        header = None
        verbose = suite.config.get('core.verbose')
        if verbose:
            header = (TERM_SUPPORT.header_str('Type'),
                      TERM_SUPPORT.header_str('Test'),
                      TERM_SUPPORT.header_str('Tag(s)'))

        for line in iter_tabular_output(matrix, header=header, strip=True):
            LOG_UI.debug(line)

        if verbose:
            if suite.resolutions:
                resolution_header = (TERM_SUPPORT.header_str('Resolver'),
                                     TERM_SUPPORT.header_str('Reference'),
                                     TERM_SUPPORT.header_str('Info'))
                LOG_UI.info("")

                mapping = {
                    ReferenceResolutionResult.SUCCESS:
                    TERM_SUPPORT.healthy_str,
                    ReferenceResolutionResult.NOTFOUND:
                    TERM_SUPPORT.fail_header_str,
                    ReferenceResolutionResult.ERROR:
                    TERM_SUPPORT.fail_header_str
                }
                resolution_matrix = []
                for r in suite.resolutions:
                    decorator = mapping.get(r.result,
                                            TERM_SUPPORT.warn_header_str)
                    if r.result == ReferenceResolutionResult.SUCCESS:
                        continue
                    resolution_matrix.append(
                        (decorator(r.origin), r.reference, r.info or ''))

                for line in iter_tabular_output(resolution_matrix,
                                                header=resolution_header,
                                                strip=True):
                    LOG_UI.info(line)

            LOG_UI.info("")
            LOG_UI.info("TEST TYPES SUMMARY")
            LOG_UI.info("==================")
            for key in sorted(suite.stats):
                LOG_UI.info("%s: %s", key, suite.stats[key])

            if suite.tags_stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TAGS SUMMARY")
                LOG_UI.info("=================")
                for key in sorted(suite.tags_stats):
                    LOG_UI.info("%s: %s", key, suite.tags_stats[key])
コード例 #3
0
ファイル: plugins.py プロジェクト: xuesong-zhang/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        plugin_types = [
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (cli):'),
            (dispatcher.JobPrePostDispatcher(),
             'Plugins that run before/after the execution of jobs (job.prepost):'
             ),
            (dispatcher.ResultDispatcher(),
             'Plugins that generate job result in different formats (result):'
             ),
            (dispatcher.ResultEventsDispatcher(args),
             ('Plugins that generate job result based on job/test events '
              '(result_events):')),
            (dispatcher.VarianterDispatcher(),
             'Plugins that generate test variants (varianter): ')
        ]
        for plugins_active, msg in plugin_types:
            log.info(msg)
            plugin_matrix = []
            for plugin in sorted(plugins_active, key=lambda x: x.name):
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                log.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    log.debug(line)
コード例 #4
0
ファイル: list.py プロジェクト: tianfenhua123/avocado
    def _display(self, test_matrix, stats, tag_stats):
        header = None
        if self.args.verbose:
            header = (output.TERM_SUPPORT.header_str('Type'),
                      output.TERM_SUPPORT.header_str('Test'),
                      output.TERM_SUPPORT.header_str('Tag(s)'))

        for line in astring.iter_tabular_output(test_matrix,
                                                header=header,
                                                strip=True):
            LOG_UI.debug(line)

        if self.args.verbose:
            LOG_UI.info("")
            LOG_UI.info("TEST TYPES SUMMARY")
            LOG_UI.info("==================")
            for key in sorted(stats):
                LOG_UI.info("%s: %s", key.upper(), stats[key])

            if tag_stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TAGS SUMMARY")
                LOG_UI.info("=================")
                for key in sorted(tag_stats):
                    LOG_UI.info("%s: %s", key, tag_stats[key])
コード例 #5
0
ファイル: plugins.py プロジェクト: morecache/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        plugin_types = [
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (cli):'),
            (dispatcher.JobPrePostDispatcher(),
             'Plugins that run before/after the execution of jobs (job.prepost):'),
            (dispatcher.ResultDispatcher(),
             'Plugins that generate job result in different formats (result):'),
            (dispatcher.ResultEventsDispatcher(args),
             ('Plugins that generate job result based on job/test events '
              '(result_events):')),
            (dispatcher.VarianterDispatcher(),
             'Plugins that generate test variants (varianter): ')
        ]
        for plugins_active, msg in plugin_types:
            log.info(msg)
            plugin_matrix = []
            for plugin in sorted(plugins_active, key=lambda x: x.name):
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                log.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    log.debug(line)
コード例 #6
0
ファイル: plugins.py プロジェクト: fgeorgatos/avocado
    def run(self, config):
        plugin_types = [
            (dispatcher.InitDispatcher(),
             'Plugins that always need to be initialized (init): '),
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (cli):'),
            (dispatcher.JobPrePostDispatcher(),
             'Plugins that run before/after the execution of jobs (job.prepost):'),
            (dispatcher.ResultDispatcher(),
             'Plugins that generate job result in different formats (result):'),
            (dispatcher.ResultEventsDispatcher(config),
             ('Plugins that generate job result based on job/test events '
              '(result_events):')),
            (dispatcher.VarianterDispatcher(),
             'Plugins that generate test variants (varianter): '),
            (Resolver(),
             'Plugins that resolve test references (resolver): '),
            (dispatcher.RunnerDispatcher(),
             'Plugins that run test suites on a job (runners): '),
        ]
        for plugins_active, msg in plugin_types:
            LOG_UI.info(msg)
            plugin_matrix = []
            for plugin in sorted(plugins_active, key=lambda x: x.name):
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                LOG_UI.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    LOG_UI.debug(line)
                LOG_UI.debug("")
コード例 #7
0
ファイル: nlist.py プロジェクト: nicob87/avocado
    def _display(self,
                 test_matrix,
                 stats,
                 tag_stats,
                 resolution_matrix,
                 verbose=False):
        header = None
        if verbose:
            header = (output.TERM_SUPPORT.header_str('Type'),
                      output.TERM_SUPPORT.header_str('Test'),
                      output.TERM_SUPPORT.header_str('Tags'))

        if test_matrix:
            for line in astring.iter_tabular_output(test_matrix,
                                                    header=header,
                                                    strip=True):
                LOG_UI.debug(line)

        if verbose:

            if stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TYPES SUMMARY")
                LOG_UI.info("==================")
                for key in sorted(stats):
                    LOG_UI.info("%s: %s", key, stats[key])

            if tag_stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TAGS SUMMARY")
                LOG_UI.info("=================")
                for key in sorted(tag_stats):
                    LOG_UI.info("%s: %s", key, tag_stats[key])

            if resolution_matrix:
                resolution_header = (
                    output.TERM_SUPPORT.header_str('Resolver'),
                    output.TERM_SUPPORT.header_str('Reference'),
                    output.TERM_SUPPORT.header_str('Info'))
                LOG_UI.info("")
                for line in astring.iter_tabular_output(
                        resolution_matrix, header=resolution_header,
                        strip=True):
                    LOG_UI.info(line)
コード例 #8
0
ファイル: list.py プロジェクト: chloerh/avocado
    def _display(self, test_matrix, stats):
        header = None
        if self.args.verbose:
            header = (self.term_support.header_str('Type'), self.term_support.header_str('Test'))

        for line in astring.iter_tabular_output(test_matrix, header=header):
            self.view.notify(event='minor', msg="%s" % line)

        if self.args.verbose:
            self.view.notify(event='minor', msg='')
            for key in sorted(stats):
                self.view.notify(event='message', msg=("%s: %s" % (key.upper(), stats[key])))
コード例 #9
0
    def _display(self, test_matrix, stats):
        header = None
        if self.args.verbose:
            header = (self.term_support.header_str('Type'), self.term_support.header_str('Test'))

        for line in astring.iter_tabular_output(test_matrix, header=header):
            self.view.notify(event='minor', msg="%s" % line)

        if self.args.verbose:
            self.view.notify(event='minor', msg='')
            for key in sorted(stats):
                self.view.notify(event='message', msg=("%s: %s" % (key.upper(), stats[key])))
コード例 #10
0
ファイル: plugins.py プロジェクト: brothermiao/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        cli_cmds = dispatcher.CLICmdDispatcher()
        msg = 'Plugins that add new commands (avocado.plugins.cli.cmd):'
        log.info(msg)
        plugin_matrix = []
        for plugin in sorted(cli_cmds):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            log.debug(line)

        msg = 'Plugins that add new options to commands (avocado.plugins.cli):'
        cli = dispatcher.CLIDispatcher()
        log.info(msg)
        plugin_matrix = []
        for plugin in sorted(cli):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            log.debug(line)
コード例 #11
0
ファイル: plugins.py プロジェクト: wkf31156/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        cli_cmds = dispatcher.CLICmdDispatcher()
        msg = 'Plugins that add new commands (avocado.plugins.cli.cmd):'
        log.info(msg)
        plugin_matrix = []
        for plugin in sorted(cli_cmds):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            log.debug(line)

        msg = 'Plugins that add new options to commands (avocado.plugins.cli):'
        cli = dispatcher.CLIDispatcher()
        log.info(msg)
        plugin_matrix = []
        for plugin in sorted(cli):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            log.debug(line)
コード例 #12
0
    def run(self, args):
        view = output.View(app_args=args, use_paginator=args.paginator == 'on')

        cli_cmds = dispatcher.CLICmdDispatcher()
        msg = 'Plugins that add new commands (avocado.plugins.cli.cmd):'
        view.notify(event='message', msg=msg)
        plugin_matrix = []
        for plugin in sorted(cli_cmds):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            view.notify(event='minor', msg=line)

        msg = 'Plugins that add new options to commands (avocado.plugins.cli):'
        cli = dispatcher.CLIDispatcher()
        view.notify(event='message', msg=msg)
        plugin_matrix = []
        for plugin in sorted(cli):
            plugin_matrix.append((plugin.name, plugin.obj.description))

        for line in astring.iter_tabular_output(plugin_matrix):
            view.notify(event='minor', msg=line)
コード例 #13
0
    def _display(self, test_matrix, stats):
        header = None
        if self.args.verbose:
            header = (output.TERM_SUPPORT.header_str('Type'),
                      output.TERM_SUPPORT.header_str('Test'))

        for line in astring.iter_tabular_output(test_matrix, header=header):
            self.log.debug(line)

        if self.args.verbose:
            self.log.debug("")
            for key in sorted(stats):
                self.log.info("%s: %s", key.upper(), stats[key])
コード例 #14
0
ファイル: list.py プロジェクト: JGMarshall/avocado
    def _display(self, test_matrix, stats):
        header = None
        if self.args.verbose:
            header = (output.TERM_SUPPORT.header_str('Type'),
                      output.TERM_SUPPORT.header_str('Test'))

        for line in astring.iter_tabular_output(test_matrix, header=header):
            self.log.debug(line)

        if self.args.verbose:
            self.log.debug("")
            for key in sorted(stats):
                self.log.info("%s: %s", key.upper(), stats[key])
コード例 #15
0
def display_images_list(images):
    """
    Displays table with information about images
    :param images: list with image's parameters
    :type images: list of dicts
    """
    image_matrix = [[
        image['name'], image['version'], image['arch'], image['file']
    ] for image in images]
    header = (output.TERM_SUPPORT.header_str('Provider'),
              output.TERM_SUPPORT.header_str('Version'),
              output.TERM_SUPPORT.header_str('Architecture'),
              output.TERM_SUPPORT.header_str('File'))
    for line in astring.iter_tabular_output(image_matrix,
                                            header=header,
                                            strip=True):
        LOG_UI.debug(line)
コード例 #16
0
ファイル: list.py プロジェクト: richtja/avocado
    def _display(self, suite, matrix):
        header = None
        verbose = suite.config.get('core.verbose')
        if verbose:
            header = (TERM_SUPPORT.header_str('Type'),
                      TERM_SUPPORT.header_str('Test'),
                      TERM_SUPPORT.header_str('Tag(s)'))

        # Any kind of color, string format and term specific should be applied
        # only during output/display phase. So this seems to be a better place
        # for this:
        matrix = self._prepare_matrix_for_display(matrix, verbose)

        for line in iter_tabular_output(matrix, header=header, strip=True):
            LOG_UI.debug(line)

        self._display_extra(suite, verbose)
コード例 #17
0
ファイル: jobs.py プロジェクト: smruti77/avocado
 def _print_job_tests(tests):
     test_matrix = []
     date_fmt = "%Y/%m/%d %H:%M:%S"
     for test in tests:
         status = test.get('status')
         decorator = output.TEST_STATUS_DECORATOR_MAPPING.get(status)
         end = datetime.fromtimestamp(test.get('end'))
         test_matrix.append(
             (test.get('id'), end.strftime(date_fmt),
              "%5f" % float(test.get('time')), decorator(status, '')))
     header = (output.TERM_SUPPORT.header_str('Test ID'),
               output.TERM_SUPPORT.header_str('End Time'),
               output.TERM_SUPPORT.header_str('Run Time'),
               output.TERM_SUPPORT.header_str('Status'))
     for line in astring.iter_tabular_output(test_matrix,
                                             header=header,
                                             strip=True):
         LOG_UI.debug(line)
コード例 #18
0
ファイル: list.py プロジェクト: mxie91/avocado
    def _display_extra(suite, verbose=True):
        """Display extra data when in verbose mode."""
        if not verbose:
            return

        if suite.resolutions:
            resolution_header = (
                TERM_SUPPORT.header_str("Resolver"),
                TERM_SUPPORT.header_str("Reference"),
                TERM_SUPPORT.header_str("Info"),
            )
            LOG_UI.info("")

            mapping = {
                ReferenceResolutionResult.SUCCESS: TERM_SUPPORT.healthy_str,
                ReferenceResolutionResult.NOTFOUND: TERM_SUPPORT.fail_header_str,
                ReferenceResolutionResult.ERROR: TERM_SUPPORT.fail_header_str,
            }
            resolution_matrix = []
            for r in suite.resolutions:
                decorator = mapping.get(r.result, TERM_SUPPORT.warn_header_str)
                if r.result == ReferenceResolutionResult.SUCCESS:
                    continue
                resolution_matrix.append(
                    (decorator(r.origin), r.reference, r.info or "")
                )

            for line in iter_tabular_output(
                resolution_matrix, header=resolution_header, strip=True
            ):
                LOG_UI.info(line)

        LOG_UI.info("")
        LOG_UI.info("TEST TYPES SUMMARY")
        LOG_UI.info("==================")
        for key in sorted(suite.stats):
            LOG_UI.info("%s: %s", key, suite.stats[key])

        if suite.tags_stats:
            LOG_UI.info("")
            LOG_UI.info("TEST TAGS SUMMARY")
            LOG_UI.info("=================")
            for key in sorted(suite.tags_stats):
                LOG_UI.info("%s: %s", key, suite.tags_stats[key])
コード例 #19
0
def display_images_list(images):
    """
    Displays table with information about images
    :param images: list with image's parameters
    :type images: list of dicts
    """
    image_matrix = [[
        image["name"], image["version"], image["arch"], image["file"]
    ] for image in images]
    header = (
        output.TERM_SUPPORT.header_str("Provider"),
        output.TERM_SUPPORT.header_str("Version"),
        output.TERM_SUPPORT.header_str("Architecture"),
        output.TERM_SUPPORT.header_str("File"),
    )
    for line in astring.iter_tabular_output(image_matrix,
                                            header=header,
                                            strip=True):
        LOG_UI.debug(line)
コード例 #20
0
ファイル: plugins.py プロジェクト: JGMarshall/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        plugin_types = [
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (avocado.plugins.cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (avocado.plugins.cli):')
        ]
        for plugins_active, msg in plugin_types:
            log.info(msg)
            plugin_matrix = []
            for plugin in sorted(plugins_active):
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                log.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    log.debug(line)
コード例 #21
0
ファイル: plugins.py プロジェクト: avocado-framework/avocado
    def run(self, config):
        plugin_types = [
            (dispatcher.InitDispatcher(),
             'Plugins that always need to be initialized (init): '),
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (cli):'),
            (dispatcher.JobPrePostDispatcher(),
             'Plugins that run before/after the execution of jobs (job.prepost):'),
            (dispatcher.ResultDispatcher(),
             'Plugins that generate job result in different formats (result):'),
            (dispatcher.ResultEventsDispatcher(config),
             ('Plugins that generate job result based on job/test events '
              '(result_events):')),
            (dispatcher.VarianterDispatcher(),
             'Plugins that generate test variants (varianter): '),
            (Resolver(),
             'Plugins that resolve test references (resolver): '),
            (dispatcher.RunnerDispatcher(),
             'Plugins that run test suites on a job (runners): '),
            (dispatcher.SpawnerDispatcher(),
             'Plugins that spawn tasks and know about their status (spawner): '),
            (dispatcher.RunnableRunnerDispatcher(),
             'Plugins that run runnables (under a task and spawner) (runnable.runner): '),
        ]
        for plugins_active, msg in plugin_types:
            LOG_UI.info(msg)
            plugin_matrix = []
            if config.get('plugins.ordered_list'):
                sorted_plugins = plugins_active.get_extentions_by_priority()
            else:
                sorted_plugins = plugins_active.get_extentions_by_name()
            for plugin in sorted_plugins:
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                LOG_UI.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    LOG_UI.debug(line)
                LOG_UI.debug("")
コード例 #22
0
    def handle_list(self, config):
        days = config.get("assets.list.days")
        size_filter = config.get("assets.list.size_filter")
        if self._count_filter_args(config) == 2:
            msg = ("You should choose --by-size-filter or --by-days. "
                   "For help, run: avocado assets list --help")
            LOG_UI.error(msg)
            return exit_codes.AVOCADO_FAIL

        cache_dirs = config.get("datadir.paths.cache_dirs")
        try:
            assets = None
            if days is not None:
                assets = Asset.get_assets_unused_for_days(days, cache_dirs)
            elif size_filter is not None:
                assets = Asset.get_assets_by_size(size_filter, cache_dirs)
            elif assets is None:
                assets = Asset.get_all_assets(cache_dirs)
        except (FileNotFoundError, OSError) as e:
            LOG_UI.error("Could get assets: %s", e)
            return exit_codes.AVOCADO_FAIL

        matrix = []
        for asset in assets:
            stat = os.stat(asset)
            basename = os.path.basename(asset)
            hash_path = f"{asset}-CHECKSUM"
            atime = datetime.fromtimestamp(stat.st_atime)
            _, checksum = Asset.read_hash_from_file(hash_path)
            matrix.append((
                basename,
                str(checksum or "unknown")[:10],
                atime.strftime("%Y-%m-%d %H:%M:%S"),
                display_data_size(stat.st_size),
            ))
        header = ("asset", "checksum", "atime", "size")
        output = list(iter_tabular_output(matrix, header))
        if len(output) == 1:
            LOG_UI.info("No asset found in your cache system.")
        else:
            for line in output:
                LOG_UI.info(line)
コード例 #23
0
ファイル: plugins.py プロジェクト: king32783784/avocado
    def run(self, args):
        log = logging.getLogger("avocado.app")
        plugin_types = [
            (dispatcher.CLICmdDispatcher(),
             'Plugins that add new commands (avocado.plugins.cli.cmd):'),
            (dispatcher.CLIDispatcher(),
             'Plugins that add new options to commands (avocado.plugins.cli):'),
            (dispatcher.JobPrePostDispatcher(),
             'Plugins that run before/after the execution of jobs (avocado.plugins.job.prepost):')
        ]
        for plugins_active, msg in plugin_types:
            log.info(msg)
            plugin_matrix = []
            for plugin in sorted(plugins_active):
                plugin_matrix.append((plugin.name, plugin.obj.description))

            if not plugin_matrix:
                log.debug("(No active plugin)")
            else:
                for line in astring.iter_tabular_output(plugin_matrix):
                    log.debug(line)
コード例 #24
0
    def handle_list(self, config):
        days = config.get('assets.list.days')
        size_filter = config.get('assets.list.size_filter')
        if (days is not None and size_filter is not None):
            msg = ("You should choose --by-size-filter or --by-days. "
                   "For help, run: avocado assets list --help")
            LOG_UI.error(msg)
            return

        # IMO, this should get data from config instead. See #4443
        cache_dirs = data_dir.get_cache_dirs()
        try:
            assets = None
            if days is not None:
                assets = Asset.get_assets_unused_for_days(days, cache_dirs)
            elif size_filter is not None:
                assets = Asset.get_assets_by_size(size_filter, cache_dirs)
            elif assets is None:
                assets = Asset.get_all_assets(cache_dirs)
        except (FileNotFoundError, OSError) as e:
            LOG_UI.error("Could get assets: %s", e)
            return

        matrix = []
        for asset in assets:
            stat = os.stat(asset)
            basename = os.path.basename(asset)
            hash_path = "{}-CHECKSUM".format(asset)
            atime = datetime.fromtimestamp(stat.st_atime)
            _, checksum = Asset.read_hash_from_file(hash_path)
            matrix.append((basename, str(checksum or "unknown")[:10],
                           atime.strftime('%Y-%m-%d %H:%M:%S'),
                           display_data_size(stat.st_size)))
        header = ("asset", "checksum", "atime", "size")
        output = list(iter_tabular_output(matrix, header))
        if len(output) == 1:
            LOG_UI.info("No asset found in your cache system.")
        else:
            for line in output:
                LOG_UI.info(line)
コード例 #25
0
ファイル: jobs.py プロジェクト: mxie91/avocado
 def _print_job_tests(tests):
     test_matrix = []
     date_fmt = "%Y/%m/%d %H:%M:%S"
     for test in tests:
         status = test.get("status")
         decorator = output.TEST_STATUS_DECORATOR_MAPPING.get(status)
         end = datetime.fromtimestamp(test.get("end"))
         test_matrix.append((
             test.get("id"),
             end.strftime(date_fmt),
             f"{float(test.get('time')):5f}",
             decorator(status, ""),
         ))
     header = (
         output.TERM_SUPPORT.header_str("Test ID"),
         output.TERM_SUPPORT.header_str("End Time"),
         output.TERM_SUPPORT.header_str("Run Time"),
         output.TERM_SUPPORT.header_str("Status"),
     )
     for line in astring.iter_tabular_output(test_matrix,
                                             header=header,
                                             strip=True):
         LOG_UI.debug(line)
コード例 #26
0
ファイル: list.py プロジェクト: clebergnu/avocado
    def _display(self, test_matrix, stats, tag_stats):
        header = None
        if self.args.verbose:
            header = (output.TERM_SUPPORT.header_str('Type'),
                      output.TERM_SUPPORT.header_str('Test'),
                      output.TERM_SUPPORT.header_str('Tag(s)'))

        for line in astring.iter_tabular_output(test_matrix, header=header,
                                                strip=True):
            LOG_UI.debug(line)

        if self.args.verbose:
            LOG_UI.info("")
            LOG_UI.info("TEST TYPES SUMMARY")
            LOG_UI.info("==================")
            for key in sorted(stats):
                LOG_UI.info("%s: %s", key.upper(), stats[key])

            if tag_stats:
                LOG_UI.info("")
                LOG_UI.info("TEST TAGS SUMMARY")
                LOG_UI.info("=================")
                for key in sorted(tag_stats):
                    LOG_UI.info("%s: %s", key, tag_stats[key])