buildtest.menu

buildtest menu: include functions to build, get test configurations, and interact with a global configuration for buildtest.

Package Contents

Classes

BuildTestParser()

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_config_edit(args=None)

Edit buildtest configuration in editor. This implements buildtest config edit

func_config_summary(args=None)

This method implements buildtest config summary option. In this method

func_config_validate(args=None)

This method implements buildtest config validate which attempts to

func_config_view(args=None)

View buildtest configuration file. This implements buildtest config view

func_report(args=None)

func_schema(args)

This method implements command buildtest schema which shows a list

buildtest.menu.BUILDTEST_VERSION = 0.8.0
class buildtest.menu.BuildTestParser
build_menu(self)

This method implements the buildtest build command

# single buildspec file

buildtest build -b <file>

# single buildspec directory (builds all buildspec in directory)

buildtest build -b <dir>

# build a buildspec and exclude some buildspecs. The exclude (-x) accepts both file and directory

buildtest build -b <file> -x <file>

# multiple buildspecs build and exclude

buildtest build -b <file> -b <dir> -x <file> -x <file>

buildspec_menu(self)

This method implements buildtest buildspec command

Command Usage

# find all buildspecs

buildtest buildspec find

# view a buildspec file

buildtest buildspec view <name>

# edit and validate a buildspec file

buildtest buildspec edit <name>

config_menu(self)

This method adds argparse argument for buildtest config

Command Usage

# view buildtest settings file

buildtest config view

# open buildtest settings in editor and validate upon saving

buildtest config edit

# validate buildtest settings

buildtest config validate

# summary of buildtest

buildtest config summary

main_menu(self)

This method adds argument to ArgumentParser to main menu of buildtest

parse_options(self)

This method parses the argument from ArgumentParser class and returns the arguments. We store extra (non parsed arguments) with the class if they are needed.

Returns

return a parsed dictionary returned by ArgumentParser

Return type

dict

report_menu(self)

This method implements the buildtest report command options

schema_menu(self)

This method adds argparse argument for buildtest show

Command Usage

# list all schema names

-buildtest schema

# list all schema in json

-buildtest schema -j

# list schema global.schema.json in json

-buildtest schema -n global.schema.json -j

# list schema examples for global.schema.json

-buildtest schema  -n global.schema.json -e

buildtest.menu.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.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

Parameters

args – Input argument from command line passed from argparse

Returns

A list of valid buildspecs found in all repositories.

buildtest.menu.func_buildspec_view(args)

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

buildtest.menu.func_config_edit(args=None)

Edit buildtest configuration in editor. This implements buildtest config edit

buildtest.menu.func_config_summary(args=None)

This method implements buildtest config summary option. In this method we will display a summary of System Details, Buildtest settings, Schemas, Repository details, Buildspecs files and test names.

buildtest.menu.func_config_validate(args=None)

This method implements buildtest config validate which attempts to validate buildtest settings with schema. If it not validate an exception an exception of type SystemError is raised. We invoke check_settings method which will validate the configuration, if it fails we except an exception of type ValidationError which we catch and print message.

buildtest.menu.func_config_view(args=None)

View buildtest configuration file. This implements buildtest config view

buildtest.menu.func_report(args=None)
buildtest.menu.func_schema(args)

This method implements command buildtest schema which shows a list of schemas, their json content and list of schema examples. The input args is an instance of argparse class that contains user selection via command line. This method can do the following

buildtest schema - Show all schema names buildtest schema --name <NAME> -j ``. View json content of a specified schema ``buildtest schema --name <NAME> -e. Show schema examples Parameters:

Parameters

args (<class 'argparse.Namespace'>) – instance of argparse class

Result

output of json schema on console

buildtest.menu.supported_schemas