handle exceptions

This commit is contained in:
Raphael Bauduin 2015-05-26 10:44:34 -07:00
parent 9617cad4a0
commit 83788f5c08

View File

@ -71,11 +71,14 @@ class TcptraceTest:
klass_name=val["name"].title().replace("_","")+"Validation"
tester_klass=globals()[klass_name]
tester = tester_klass(val)
try:
if tester.validate(tested_value):
self.logs=self.logs+ ("" if self.logs=="" else "\n ")+ " -" +tester.name()+" OK\n"
else:
self.logs=self.logs+ ("" if self.logs=="" else "\n ")+ " -" +tester.name()+" FAILS "+ val["desc"] +"\n"
is_ok = False
except Exception as e:
self.logs=self.logs+ ("" if self.logs=="" else "\n ")+ " -" +tester.name()+" FAILS (EXCEPTION:"+ str(e) + ") "+ val["desc"] +"\n"
return is_ok
def name(self):
return self.__class__.__name__