From 3f4fd6ec0369b3285cc5f4f8f095c2d4b760fe85 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 1 Sep 2016 14:48:51 +0530 Subject: changed format of tracebacks --- yaksh/code_evaluator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'yaksh') diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py index 2fb429f..d0cac62 100644 --- a/yaksh/code_evaluator.py +++ b/yaksh/code_evaluator.py @@ -108,9 +108,14 @@ class CodeEvaluator(object): except TimeoutException: err = self.timeout_msg + except OSError: + msg = traceback.format_exc(limit=0) + err = "Error: {0}".format(msg) except Exception: - err = "Error: {0}".format(traceback.format_exc(limit=0)) - + exc_type, exc_value, exc_tb = sys.exc_info() + tb_list = traceback.format_exception(exc_type, exc_value, exc_tb) + del tb_list[1:3] + err = "Error: {0}".format("".join(tb_list)) finally: # Set back any original signal handler. set_original_signal_handler(prev_handler) -- cgit From 231029d3942c020733807c353314ec91e327af07 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 1 Sep 2016 14:52:01 +0530 Subject: changes in test cases for tracebacks --- yaksh/evaluator_tests/test_python_evaluation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'yaksh') diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py index b432630..493a3c2 100644 --- a/yaksh/evaluator_tests/test_python_evaluation.py +++ b/yaksh/evaluator_tests/test_python_evaluation.py @@ -117,7 +117,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): result = get_class.evaluate(**kwargs) err = result.get("error").splitlines() self.assertFalse(result.get("success")) - self.assertEqual(2, len(err)) + self.assertEqual(3, len(err)) for msg in name_error_msg: self.assertIn(msg, result.get("error")) @@ -139,7 +139,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): result = get_class.evaluate(**kwargs) err = result.get("error").splitlines() self.assertFalse(result.get("success")) - self.assertEqual(2, len(err)) + self.assertEqual(969, len(err)) for msg in recursion_error_msg: self.assertIn(msg, result.get("error")) @@ -162,7 +162,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): result = get_class.evaluate(**kwargs) err = result.get("error").splitlines() self.assertFalse(result.get("success")) - self.assertEqual(2, len(err)) + self.assertEqual(3, len(err)) for msg in type_error_msg: self.assertIn(msg, result.get("error")) @@ -186,7 +186,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): result = get_class.evaluate(**kwargs) err = result.get("error").splitlines() self.assertFalse(result.get("success")) - self.assertEqual(2, len(err)) + self.assertEqual(4, len(err)) for msg in value_error_msg: self.assertIn(msg, result.get("error")) -- cgit From 42dea8646ffc84aba764361690b18f5eadec631e Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 1 Sep 2016 14:52:30 +0530 Subject: changed Quiz displaying template --- yaksh/templates/yaksh/question.html | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'yaksh') diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 9a0f899..2bae002 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -102,6 +102,10 @@ function call_skip(url) +