Browse Source

[skip ci] Fix minor bug with exception handling in validation

Alex Schneider 11 years ago
parent
commit
76d6fbe4e8
1 changed files with 10 additions and 10 deletions
  1. 10 10
      toolset/benchmark/framework_test.py

+ 10 - 10
toolset/benchmark/framework_test.py

@@ -158,7 +158,7 @@ class FrameworkTest:
       if  obj["message"].lower() != "hello, world!":
         err_str += "Message was '{message}', should have been 'Hello, World!' ".format(message=obj["message"])
     except:
-      err_str += "Got exception when trying to validate the JSON test: {exception}".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the JSON test: {exception}".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   ############################################################
@@ -203,7 +203,7 @@ class FrameworkTest:
       if not random_num_ret_val:
         err_str += "Expected id to be type int or float, got '{rand}' ".format(rand=obj["randomnumber"])
     except:
-      err_str += "Got exception when trying to validate the db test: {exception}".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the db test: {exception}".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   def validateDbStrict(self, jsonString, out, err):
@@ -235,7 +235,7 @@ class FrameworkTest:
         err_str += "Expected id to be type int or float, got '{rand}' ".format(rand=obj["randomnumber"])
       return id_ret_val and random_num_ret_val
     except:
-      err_str += "Got exception when trying to validate the db test: {exception}".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the db test: {exception}".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
 
@@ -275,7 +275,7 @@ class FrameworkTest:
         if not random_num_ret_val:
           err_str += "Expected randomNumber to be type int or float, got '{rand}' ".format(rand=obj["randomnumber"])
     except:
-      err_str += "Got exception when trying to validate the query test: {exception}".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the query test: {exception}".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   ############################################################
@@ -288,7 +288,7 @@ class FrameworkTest:
     err_str = ""
     if jsonString is None or len(jsonString) == 0:
       err_str += "Empty Response"
-    else
+    else:
       try:
         json_load = json.loads(jsonString)
         if not isinstance(json_load, list):
@@ -316,7 +316,7 @@ class FrameworkTest:
         if not random_num_ret_val:
           err_str += "Expected randomNumber to be type int or float, got '{rand}'. ".format(rand=obj["randomnumber"])
       except:
-        err_str += "Got exception when trying to validate the query test: {exception} ".format(exception=traceback.print_exc())
+        err_str += "Got exception when trying to validate the query test: {exception} ".format(exception=traceback.format_exc())
 
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
@@ -359,7 +359,7 @@ class FrameworkTest:
         if not random_num_ret_val:
           err_str += "Expected randomNumber to be type int or float, got '{rand}'. ".format(rand=obj["randomnumber"])
     except:
-      err_str += "Got exception when trying to validate the query test: {exception} ".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the query test: {exception} ".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   ############################################################
@@ -377,7 +377,7 @@ class FrameworkTest:
 
       return parser.isValidFortune(out)
     except:
-      print "Got exception when trying to validate the fortune test: {exception} ".format(exception=traceback.print_exc())
+      print "Got exception when trying to validate the fortune test: {exception} ".format(exception=traceback.format_exc())
     return (False, err_str)
 
   ############################################################
@@ -416,7 +416,7 @@ class FrameworkTest:
         if not random_num_ret_val:
           err_str += "Expected randomNumber to be type int or float, got '{rand}'.\n".format(rand=obj["randomnumber"])
     except:
-      err_str += "Got exception when trying to validate the update test: {exception}\n".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the update test: {exception}\n".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   ############################################################
@@ -431,7 +431,7 @@ class FrameworkTest:
       if not jsonString.lower().strip() == "hello, world!":
         err_str += "Expected 'Hello, World!', got '{message}'.\n".format(message=jsonString.strip())
     except:
-      err_str += "Got exception when trying to validate the plaintext test: {exception}\n".format(exception=traceback.print_exc())
+      err_str += "Got exception when trying to validate the plaintext test: {exception}\n".format(exception=traceback.format_exc())
     return (True, ) if len(err_str) == 0 else (False, err_str)
 
   ############################################################