From e615c7b5cc922db1b92891b327e25258d778bd07 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Fri, 16 Sep 2016 19:27:49 +0530 Subject: bug fixes in python assertion evaluator --- yaksh/code_evaluator.py | 3 +-- yaksh/python_assertion_evaluator.py | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py index e139b55..8a9b7a6 100644 --- a/yaksh/code_evaluator.py +++ b/yaksh/code_evaluator.py @@ -101,6 +101,7 @@ class CodeEvaluator(object): # Do whatever testing needed. try: for test_case in test_case_data: + success = False self.compile_code(user_answer, file_paths, **test_case) success, err = self.check_code(user_answer, file_paths, **test_case) if not success: @@ -116,8 +117,6 @@ class CodeEvaluator(object): tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) if len(tb_list) > 2: del tb_list[1:3] - else: - pass err = "Error: {0}".format("".join(tb_list)) finally: # Set back any original signal handler. diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index 04a4e69..b9f0a55 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -49,6 +49,8 @@ class PythonAssertionEvaluator(CodeEvaluator): err = "{0} {1} in: {2}".format(type.__name__, str(value), text) except TimeoutException: raise + except Exception: + raise # Exception will be caught in CodeEvaluator. else: success = True err = 'Correct answer' -- cgit