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

BuildspecParser(buildspec)

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. If a version is provided, honor it. If not, use latest. We also don’t allow repeated keys in the same file.

_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)

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:

Parameters

testdir (str, optional) – Test Destination directory, specified by –testdir

keys(self)

Return the list of keys for the loaded Buildspec recipe, not including the metadata keys defined for any global recipe.