buildtest.cli.inspect

This module implements methods for buildtest inspect command that can be used to retrieve test record from report file in JSON format.

Module Contents

Functions

fetch_test_names(report, names)

Return a list of builders given input test names by search the report file for valid records. If test is found it will be returned as a builder name. If names

print_builders(report)

This method prints all the builders.

print_terse(table[, no_header, console_color])

This method prints output of builders in terse mode which is run via command buildtest inspect list --terse

inspect_list(report[, terse, no_header, builder, ...])

This method list an output of test id, name, and buildspec file from the report cache. The default

print_by_query(report, name[, theme, output, error, ...])

This method prints the test records when they are queried using buildtest inspect query command.

inspect_query(report, name[, theme, output, error, ...])

Entry point for buildtest inspect query command.

inspect_buildspec(report, input_buildspecs[, ...])

This method implements command buildtest inspect buildspec

print_by_name(report, names)

This method prints test records by given name in JSON format.

inspect_by_name(report, names[, pager])

Implements command buildtest inspect name which will print all test records by given name in JSON format.

buildtest.cli.inspect.fetch_test_names(report, names)[source]

Return a list of builders given input test names by search the report file for valid records. If test is found it will be returned as a builder name. If names are specified without test ID then we retrieve latest record for test name. If names are specified with ID we find the first matching test record.

Parameters:
buildtest.cli.inspect.print_builders(report)[source]

This method prints all the builders.

Parameters:

report (str) – Path to report file

buildtest.cli.inspect.print_terse(table, no_header=None, console_color=None)[source]

This method prints output of builders in terse mode which is run via command buildtest inspect list --terse

Parameters:
  • table (dict) – Table with columns required for the buildtest inspect list command.

  • no_header (bool, optional) – Determine whether to print header in terse format.

  • console_color (bool, optional) – Select desired color when displaying results

buildtest.cli.inspect.inspect_list(report, terse=None, no_header=None, builder=None, color=None, pager=None, row_count=None)[source]

This method list an output of test id, name, and buildspec file from the report cache. The default behavior is to display output in table format though this can be changed with terse format which will display in parseable format. This method implements command buildtest inspect list

Parameters:
  • report (str) – Path to report file

  • terse (bool, optional) – Print output in terse format

  • no_header (bool, optional) – Determine whether to print header in terse format.

  • builder (bool, optional) – Print output in builder format which can be done via buildtest inspect list --builder

  • color (bool, optional) – Print table output of buildtest inspect list with selected color

  • pager (bool, optional) – Print output in paging format

  • row_count (bool, optional) – Print total number of test runs

buildtest.cli.inspect.print_by_query(report, name, theme=None, output=None, error=None, testpath=None, buildscript=None, buildenv=None)[source]

This method prints the test records when they are queried using buildtest inspect query command.

Parameters:
  • report (buildtest.cli.report.Report) – An instance of Report class

  • name (list) – List of test names to query

  • theme (str, optional) – Specify pygments theme for syntax highlighting

  • output (bool, optional) – Print output file when set to True

  • error (bool, optional) – Print error file when set to True

  • testpath (bool, optional) – Print testpath when set to True

  • buildscript (bool, optional) – Print buildscript when set to True

  • buildenv (bool, optional) – Print buildenv when set to True

buildtest.cli.inspect.inspect_query(report, name, theme=None, output=None, error=None, testpath=None, buildscript=None, buildenv=None, pager=None)[source]

Entry point for buildtest inspect query command.

Parameters:
  • report (buildtest.cli.report.Report) – An instance of Report class

  • name (list) – List of test names to query

  • theme (str, optional) – Specify pygments theme for syntax highlighting

  • output (bool, optional) – Print output file when set to True

  • error (bool, optional) – Print error file when set to True

  • testpath (bool, optional) – Print testpath when set to True

  • buildscript (bool, optional) – Print buildscript when set to True

  • buildenv (bool, optional) – Print buildenv when set to True

  • pager (bool, optional) – Print output in paging format

buildtest.cli.inspect.inspect_buildspec(report, input_buildspecs, all_records=None, pager=None)[source]

This method implements command buildtest inspect buildspec

Parameters:
  • report (buildtest.cli.report.Report) – An instance of Report class

  • input_buildspecs (list) – List of buildspecs to search in report file. This is specified as positional arguments to buildtest inspect buildspec

  • all_records (bool) – Determine whether to display all records for every test that matches the buildspec. By default we retrieve the latest record.

  • pager (bool, optional) – Print output in paging format

buildtest.cli.inspect.print_by_name(report, names)[source]

This method prints test records by given name in JSON format.

Parameters:
  • report (buildtest.cli.report.Report) – An instance of Report class

  • names (list) – List of test names to search in report file. This is specified as positional arguments to buildtest inspect name

buildtest.cli.inspect.inspect_by_name(report, names, pager=None)[source]

Implements command buildtest inspect name which will print all test records by given name in JSON format.

# get last run for test exit1_fail
buildtest inspect name exit1_fail
# get record exit1_fail that starts with id 123
buildtest inspect name exit1_fail/123
Parameters:
  • report (buildtest.cli.report.Report) – An instance of Report class

  • names (list) – List of test names to search in report file. This is specified as positional arguments to buildtest inspect name

  • pager (bool, optional) – Print output in paging format