Refactor validators into a list, and add a custom validator function, which is passed the YAML as an argument, and will return (rv,msgs) to signal custom semantic validation results

This commit is contained in:
Pim van Pelt
2022-04-09 20:12:21 +00:00
parent d6e3496809
commit 1230e04c3e
2 changed files with 29 additions and 35 deletions

View File

@ -27,6 +27,14 @@ except ImportError:
print("ERROR: install argparse manually: sudo pip install argparse")
sys.exit(-2)
def example_validator(yaml):
""" A simple example validator that takes the YAML configuration file as an input,
and returns a tuple of rv (return value, True is success), and a list of string
messages to the validation framework. """
rv = True
msgs = []
return rv, msgs
class YAMLTest(unittest.TestCase):
def __init__(self, testName, yaml_filename, yaml_schema):