buildtest.menu.buildspec

Module Contents

Functions

func_buildspec_edit(args)

This method implement buildtest buildspec edit which

func_buildspec_find(args)

Entry point for buildtest buildspec find. This method

func_buildspec_view(args)

This method implements buildtest buildspec view which shows

func_buildspec_view_edit(buildspec, view=False, edit=False)

This is a shared method for buildtest buildspec view and

get_all_tags(cache)

This method implements buildtest buildspec find --tags which

get_buildspecfiles(cache)

This method implements buildtest buildspec find --buildspec-files which

get_executors(cache)

This method implements buildtest buildspec find --list-executors which

parse_buildspecs(buildspecs, test_directory, rebuild, tags=None, executors=None, printTable=False)

Parse all buildspecs by invoking class BuildspecParser. If buildspec

rebuild_buildspec_cache(paths)

This method will rebuild the buildspec cache file by recursively searching

buildtest.menu.buildspec.func_buildspec_edit(args)

This method implement buildtest buildspec edit which allows one to edit a Buildspec file with one of the editors set in buildtest settings.

buildtest.menu.buildspec.func_buildspec_find(args)

Entry point for buildtest buildspec find. This method will attempt to read for buildspec cache file (BUILDSPEC_CACHE_FILE) if found and print a list of all buildspecs. Otherwise, it will read the repo file (REPO_FILE) and find all buildspecs and validate them via BuildspecParser. BuildspecParser will raise SystemError or ValidationError if a buildspec is invalid which will be added to list of invalid buildspecs. Finally we print a list of all valid buildspecs and any invalid buildspecs are written to file along with error message.

Parameters

args – Input argument from command line passed from argparse

Returns

A list of valid buildspecs found in all repositories.

buildtest.menu.buildspec.func_buildspec_view(args)

This method implements buildtest buildspec view which shows content of a buildspec file

buildtest.menu.buildspec.func_buildspec_view_edit(buildspec, view=False, edit=False)

This is a shared method for buildtest buildspec view and buildtest buildspec edit.

Parameters
  • buildspec (str (filepath)) – buildspec file section to view or edit.

  • view (bool) – boolean to determine if we want to view buildspec file

  • edit (bool) – boolean to control if we want to edit buildspec file in editor.

Returns

Shows the content of buildspec or let’s user interactively edit buildspec. An exception can be raised if it’s unable to find buildspec

buildtest.menu.buildspec.get_all_tags(cache)

This method implements buildtest buildspec find --tags which reports a list of unique tags from all buildspecs in cache file.

Parameters

cache (dict) – content of cache as dictionary

buildtest.menu.buildspec.get_buildspecfiles(cache)

This method implements buildtest buildspec find --buildspec-files which reports all buildspec files in cache.

Parameters

cache (dict) – content of cache as dictionary

buildtest.menu.buildspec.get_executors(cache)

This method implements buildtest buildspec find --list-executors which reports all executors from cache.

Parameters

cache (dict) – content of cache as dictionary

buildtest.menu.buildspec.logger
buildtest.menu.buildspec.parse_buildspecs(buildspecs, test_directory, rebuild, tags=None, executors=None, printTable=False)

Parse all buildspecs by invoking class BuildspecParser. If buildspec fails validation we add it to skipped_tests list and print all skipped tests at end. If buildspec passes validation we get all builders by invoking get_builders method in BuildspecParser class which gets all tests from buildspec file.

Parameters
  • buildspecs (list of filepaths) – A list of input buildspecs to parse

  • test_directory (str (directory path)) – Test directory where buildspecs will be written

  • tags (list) – A list of input tags to filter tests

  • executors (list) – A list of input executors to filter tests

  • printTable (bool, optional) – a boolean to control if parse table is printed

Returns

A list of builder objects which are instances of BuilderBase class

Return type

list

buildtest.menu.buildspec.rebuild_buildspec_cache(paths)

This method will rebuild the buildspec cache file by recursively searching all .yml files specified by input argument paths which is a list of directory roots. The buildspecs are validated and cache file is updated”

Parameters

paths (list) – A list of directory roots to process buildspecs files.

Returns

Rebuild cache file