diff options
author | ankitjavalkar | 2017-02-09 18:30:00 +0530 |
---|---|---|
committer | ankitjavalkar | 2017-02-10 17:21:09 +0530 |
commit | 8eea8e99258f073374912985acc191295536deeb (patch) | |
tree | 4643493b0b9e813ea5c839c51b3651c8f02f81e3 /yaksh | |
parent | 3fc351255d48f769641195d0f7b8fb7454992185 (diff) | |
download | online_test-8eea8e99258f073374912985acc191295536deeb.tar.gz online_test-8eea8e99258f073374912985acc191295536deeb.tar.bz2 online_test-8eea8e99258f073374912985acc191295536deeb.zip |
Format the assertion and various error exceptions for Python Assertion evaluator
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 11fa101..9e1a6ac 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -2,6 +2,7 @@ import sys import traceback import os +import re from os.path import join import importlib @@ -84,9 +85,17 @@ class PythonAssertionEvaluator(BaseEvaluator): ) except TimeoutException: raise - except Exception: + except RecursionError: msg = traceback.format_exc(limit=0) - err = "Error in Test case: {0}".format(msg) + err = "Error Traceback: {0}".format(msg) + except Exception: + err_tb_lines = traceback.format_exc().splitlines() + stripped_tb_lines = [] + for line in err_tb_lines: + if '.py' not in line: + stripped_tb_lines.append(line) + stripped_tb = '\n'.join(stripped_tb_lines) + err = "Error Traceback:\n{0}".format(stripped_tb) else: success = True err = None |