diff --git a/tests.py b/tests.py index 2d8a09d..4684254 100755 --- a/tests.py +++ b/tests.py @@ -73,7 +73,7 @@ def main(): for fn in glob.glob(pattern): tests = tests + 1 unittest, cfg = load_unittest(fn) - if not unittest or not cfg: + if not unittest: errors = errors + 1 continue diff --git a/unittest/correct-empty.yaml b/unittest/correct-empty.yaml new file mode 100644 index 0000000..aa3fe59 --- /dev/null +++ b/unittest/correct-empty.yaml @@ -0,0 +1,6 @@ +test: + description: "A completely empty config file is, ironically, correct" + errors: + count: 0 +--- + diff --git a/validator/__init__.py b/validator/__init__.py index 9fc9a35..13f62af 100644 --- a/validator/__init__.py +++ b/validator/__init__.py @@ -74,6 +74,9 @@ class Validator(object): def validate(self, yaml): ret_rv = True ret_msgs = [] + if not yaml: + return ret_rv, ret_msgs + if self.schema: try: self.logger.debug("Validating against schema %s" % self.schema)