buildtest.cli.buildspec
¶
Module Contents¶
Classes¶
Functions¶
|
Entry point for |
Attributes¶
- class buildtest.cli.buildspec.BuildspecCache(configuration, rebuild=False, filterfields=None, formatfields=None, roots=None)¶
- default_format_fields = ['name', 'type', 'executor', 'tags', 'description']¶
- filter_fields = ['type', 'executor', 'tags']¶
- format_fields¶
- table¶
- _discover_buildspecs(self)¶
This method retrieves buildspecs based on
self.paths
which is a list of directory paths to search. If--root
is specified we process each argument and recursively find all .yml files
- _filter_buildspecs(self, executor, tags, schema_type)¶
This method will return a boolean True/False that determines if buildspec test entry is skipped as part of filter process. The filter are done based on executor, tags, type field.
True
indicates test needs to be skipped.- Parameters
executor (str, required) – ‘executor; field from buildspec recipe
tags (str or list, required) – ‘tags’ field from buildspec recipe
schema_type (str, required) – ‘type’ field from buildspec recipe
- Returns
boolean to determine if we need to skip buildspec
- Return type
bool
- _validate_buildspecs(self, buildspecs)¶
Given a list of buildspec files, validate each buildspec using BuildspecParser and return a list of valid buildspecs. Any invalid buildspecs are added to separate list
- _write_buildspec_cache(self)¶
This method is responsible for writing buildspec cache to file
- build(self)¶
This method will build buildspec cache file. If user requests to rebuild cache we remove the file and recreate cache. If cache file exists, we simply load from cache
- build_cache(self)¶
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
- check_filter_fields(self)¶
This method checks filter fields are valid. The filter fields are specified as ``buildtest buildspec find –filter <KEY1>=<VAL1>,<KEY2>=<VAL2>,…
- check_format_fields(self)¶
This method will check if all format fields are valid. Format fields are passed comma separated as –format field1,field2,field3,…
- find_buildspecs(self)¶
This method will find buildspecs based on cache content. We skip any tests based on executor filter, tag filter or type filter and build a table of tests that will be printed using
print_buildspecs
method.
- get_buildspecfiles(self)¶
This method implements
buildtest buildspec find --buildspec-files
which reports all buildspec files in cache.
- get_cache(self)¶
Returns cache file as loaded dictionary
- get_executors(self)¶
This method implements
buildtest buildspec find --executors
which reports all executors from cache.
- get_tags(self)¶
This method implements
buildtest buildspec find --tags
which reports a list of unique tags from all buildspecs in cache file.
- load_paths(self)¶
Add all paths to search for buildspecs. We must read configuration file and check property
buildspec_roots
for list of directories to search. We check all directories exist, if any fail we don’t add them to path. In addition, we add the default buildspec path where we find tutorials and general tests.
- print_buildspecs(self)¶
Print buildspec table
- print_by_executors(self)¶
This method prints executors by tests and implements
buildtest buildspec find --group-by-executor
command
- print_by_tags(self)¶
This method prints tags by tests and implements
buildtest buildspec find --group-by-tags
command
- static print_filter_fields()¶
This method prints filter fields available for buildspec cache. This method implements command
buildtest buildspec find --helpfilter
- static print_format_fields()¶
This method prints format fields available for buildspec cache. This method implements command
buildtest buildspec find --helpformat
- print_maintainer(self)¶
This method prints maintainers from buildspec cache file which implements
buildtest buildspec find --maintainers
command.
- print_maintainers_by_buildspecs(self)¶
This method prints maintainers breakdown by buildspecs. This method implements
buildtest buildspec find --maintainers-by-buildspecs
- print_paths(self)¶
This method print buildspec paths, this implements command
buildtest buildspec find --paths
- buildtest.cli.buildspec.buildspec_find(args, configuration)¶
Entry point for
buildtest buildspec find
command
- buildtest.cli.buildspec.logger¶