diff --git a/src/mpIterator.py b/src/mpIterator.py index d428728..1ada58e 100755 --- a/src/mpIterator.py +++ b/src/mpIterator.py @@ -62,16 +62,17 @@ for test_name in [name for name in os.listdir(tests_dir) if os.path.isdir(os.pat # Run validations with open(validation_file, 'r') as f: validations = load(f) - for k in validations.keys(): - # Identify checker class - name = k.title().replace("_","")+"Checker" - klass= globals()[name] - # instantiate checker with validations and test_name - checker = klass(validations, test_name, destDir) - if checker.check(): - print checker.logs - else: - print checker.logs + if validations!=None: + for k in validations.keys(): + # Identify checker class + name = k.title().replace("_","")+"Checker" + klass= globals()[name] + # instantiate checker with validations and test_name + checker = klass(validations, test_name, destDir) + if checker.check(): + print checker.logs + else: + print checker.logs diff --git a/src/mpValidations.py b/src/mpValidations.py index 6b7722b..563fa99 100644 --- a/src/mpValidations.py +++ b/src/mpValidations.py @@ -141,16 +141,17 @@ class Checker: def check(self): is_ok = True self.logs=self.test_id+"\n" - for test in self.yml: - name=test["test"].title().replace("_","")+"Test" - klass = globals()[name] - r = klass(test, self.trace) - if r.validate(): - self.logs = self.logs + " *" + self.test_id + " " + r.name() + " SUCCESS\n" - self.logs = self.logs + r.logs - else: - self.logs = self.logs + " *" + self.test_id + " " + r.name() + " FAIL\n" - self.logs = self.logs + r.logs + if self.yml!=None: + for test in self.yml: + name=test["test"].title().replace("_","")+"Test" + klass = globals()[name] + r = klass(test, self.trace) + if r.validate(): + self.logs = self.logs + " *" + self.test_id + " " + r.name() + " SUCCESS\n" + self.logs = self.logs + r.logs + else: + self.logs = self.logs + " *" + self.test_id + " " + r.name() + " FAIL\n" + self.logs = self.logs + r.logs # Runs tests based on tcptrace # It (in the method inherited from its parent class) instanciates the ...Test class passing it the TcptraceData instance