:py:mod:`buildtest.cli.inspect` =============================== .. py:module:: buildtest.cli.inspect .. autoapi-nested-parse:: 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 ~~~~~~~~~ .. autoapisummary:: buildtest.cli.inspect.print_by_query buildtest.cli.inspect.fetch_test_names buildtest.cli.inspect.print_builders buildtest.cli.inspect.inspect_list buildtest.cli.inspect.inspect_query buildtest.cli.inspect.inspect_buildspec buildtest.cli.inspect.print_by_name buildtest.cli.inspect.inspect_by_name .. py:function:: print_by_query(report, name, theme=None, output=None, error=None, testpath=None, buildscript=None, buildenv=None) This method prints the test records when they are queried using ``buildtest inspect query`` command. :param report: An instance of Report class :type report: buildtest.cli.report.Report :param name: List of test names to query :type name: list :param theme: Specify pygments theme for syntax highlighting :type theme: str, optional :param output: Print output file when set to True :type output: bool, optional :param error: Print error file when set to True :type error: bool, optional :param testpath: Print testpath when set to True :type testpath: bool, optional :param buildscript: Print buildscript when set to True :type buildscript: bool, optional :param buildenv: Print buildenv when set to True :type buildenv: bool, optional .. py:function:: 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 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. :param report: An instance of Report class :type report: buildtest.cli.report.Report :param names: A list of test names :type names: list .. py:function:: print_builders(report, pager=None, color=None) This method prints all the builders. :param report: Path to report file :type report: str .. py:function:: inspect_list(report, terse=None, no_header=None, builder=None, color=None, pager=None, row_count=None) 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`` :param report: Path to report file :type report: str :param terse: Print output in terse format :type terse: bool, optional :param no_header: Determine whether to print header in terse format. :type no_header: bool, optional :param builder: Print output in builder format which can be done via ``buildtest inspect list --builder`` :type builder: bool, optional :param color: Print table output of ``buildtest inspect list`` with selected color :type color: bool, optional :param pager: Print output in paging format :type pager: bool, optional :param row_count: Print total number of test runs :type row_count: bool, optional .. py:function:: inspect_query(report, name, theme=None, output=None, error=None, testpath=None, buildscript=None, buildenv=None, pager=None) Entry point for ``buildtest inspect query`` command. :param report: An instance of Report class :type report: buildtest.cli.report.Report :param name: List of test names to query :type name: list :param theme: Specify pygments theme for syntax highlighting :type theme: str, optional :param output: Print output file when set to True :type output: bool, optional :param error: Print error file when set to True :type error: bool, optional :param testpath: Print testpath when set to True :type testpath: bool, optional :param buildscript: Print buildscript when set to True :type buildscript: bool, optional :param buildenv: Print buildenv when set to True :type buildenv: bool, optional :param pager: Print output in paging format :type pager: bool, optional .. py:function:: inspect_buildspec(report, input_buildspecs, all_records=None, pager=None) This method implements command ``buildtest inspect buildspec`` :param report: An instance of Report class :type report: buildtest.cli.report.Report :param input_buildspecs: List of buildspecs to search in report file. This is specified as positional arguments to ``buildtest inspect buildspec`` :type input_buildspecs: list :param all_records: Determine whether to display all records for every test that matches the buildspec. By default we retrieve the latest record. :type all_records: bool :param pager: Print output in paging format :type pager: bool, optional .. py:function:: print_by_name(report, names) This method prints test records by given name in JSON format. :param report: An instance of Report class :type report: buildtest.cli.report.Report :param names: List of test names to search in report file. This is specified as positional arguments to ``buildtest inspect name`` :type names: list .. py:function:: inspect_by_name(report, names, pager=None) Implements command ``buildtest inspect name`` which will print all test records by given name in JSON format. .. code-block:: console # get last run for test exit1_fail buildtest inspect name exit1_fail .. code-block:: console # get record exit1_fail that starts with id 123 buildtest inspect name exit1_fail/123 :param report: An instance of Report class :type report: buildtest.cli.report.Report :param names: List of test names to search in report file. This is specified as positional arguments to ``buildtest inspect name`` :type names: list :param pager: Print output in paging format :type pager: bool, optional