buildtest.buildsystem.parser
¶
BuildspecParser is intended to read in a Buildspec file with one or more test blocks, and then generate builders based on the type of each. The BuilderBase is the base class for all builders that expose functions to run builds.
Module Contents¶
Classes¶
|
A BuildspecParser is a base class for loading and validating a Buildspec file. |
-
class
buildtest.buildsystem.parser.
BuildspecParser
(buildspec)¶ A BuildspecParser is a base class for loading and validating a Buildspec file. The type (e.g., script) and version are derived from reading in the file, and then matching to a Buildspec schema, each of which is developed at https://github.com/buildtesters/schemas and added to subfolders named accordingly under buildtest/buildsystem/schemas. The schema object can load in a general Buildspec file to validate it, and then match it to a Buildspec Schema available. If the version of a schema is not specified, we use the latest. If the schema fails validation check, then we stop immediately.
-
__repr__
(self)¶ Return repr(self).
-
__str__
(self)¶ Return str(self).
-
_validate
(self)¶ Given a loaded recipe, validate that the type is known in the lookup to buildtest. We check that
type
is found in schema lookup table, andexecutor
field is a valid executor. Finally we validate loaded recipe with sub-schema
-
_validate_global
(self)¶ The global validation ensures that the overall structure of the file is sound for further parsing. We load in the global.schema.json for this purpose. The function also allows a custom Buildspec to extend the usage of the class.
-
get
(self, name)¶ Given the name of a section (typically a build configuration name) return the loaded section from self.recipe. If you need to parse through just section names, use self.keys() to filter out metadata.
-
get_builders
(self, testdir, rebuild=1, tag_filter=None, executor_filter=None)¶ Based on a loaded Buildspec file, return the correct builder for each based on the type. Each type is associated with a known Builder class.
- Parameters
testdir (str, optional) – Test Destination directory, specified by –testdir
tag_filter (list, optional) – A list of input tags (
buildtest build --tags
option) to filter buildersexecutor_filter – A list of input executors (
buildtest build --executor
option) to filter builders
-
keys
(self)¶ Return the list of keys for the loaded Buildspec recipe, not including the metadata keys defined for any global recipe.
-
-
buildtest.buildsystem.parser.
configuration
¶
-
buildtest.buildsystem.parser.
executors
¶
-
buildtest.buildsystem.parser.
master_executors
¶