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, buildexecutor)¶
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.
The schemas are located in buildtest/schemas, we load the schema dictionary and validate each buildspec with global schema and a sub-schema based on the
type
field. If the schema fails validation check, then we stop immediately.- __repr__(self)¶
Return repr(self).
- __str__(self)¶
Return str(self).
- _check_executor(self, test)¶
This method checks if
executor
property is not None and executor value is found in list of available executors.- Parameters
test (str, required) – name of test in
buildspecs
property in buildspec file
- _check_schema_type(self, test)¶
Check
type
field is a valid sub-schema and verifytype
+version
will resolve to a schema file.
- _validate(self)¶
This method will validate the entire buildspec file with global schema and each test section with a sub-schema. 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.
A buildspec is composed of one or more tests, each section is validated with a sub-schema. The
type
field is used for sub-schema lookup from schema library. Finally we validate loaded recipe with sub-schema.