From 8eea8e99258f073374912985acc191295536deeb Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 9 Feb 2017 18:30:00 +0530 Subject: Format the assertion and various error exceptions for Python Assertion evaluator --- yaksh/python_assertion_evaluator.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'yaksh/python_assertion_evaluator.py') 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 -- cgit