summaryrefslogtreecommitdiff
path: root/yaksh/grader.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-18 16:10:22 +0530
committerankitjavalkar2016-12-21 18:12:52 +0530
commit15de9ce5fe9d1e456bfae60090807a77c6afef0a (patch)
tree8f7d8c96da853ed8629b50305da099bf51f75095 /yaksh/grader.py
parent77e8a6c1cde9190daf9075d71caf6017dc1380e7 (diff)
downloadonline_test-15de9ce5fe9d1e456bfae60090807a77c6afef0a.tar.gz
online_test-15de9ce5fe9d1e456bfae60090807a77c6afef0a.tar.bz2
online_test-15de9ce5fe9d1e456bfae60090807a77c6afef0a.zip
Fix output rendering in the question
Diffstat (limited to 'yaksh/grader.py')
-rw-r--r--yaksh/grader.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/yaksh/grader.py b/yaksh/grader.py
index ef349e0..db15e59 100644
--- a/yaksh/grader.py
+++ b/yaksh/grader.py
@@ -96,7 +96,7 @@ class Grader(object):
Returns
-------
- A tuple: (success, error message, weight).
+ A tuple: (success, error, weight).
"""
self.setup()
@@ -135,7 +135,7 @@ class Grader(object):
prev_handler = create_signal_handler()
success = False
test_case_success_status = [False] * len(test_case_instances)
- error = ""
+ error = []
weight = 0.0
# Do whatever testing needed.
@@ -148,7 +148,7 @@ class Grader(object):
if test_case_success:
weight += mark_fraction
- error += err + "\n"
+ error.append(err)
test_case_success_status[idx] = test_case_success
success = all(test_case_success_status)
@@ -157,16 +157,16 @@ class Grader(object):
test_case_instance.teardown()
except TimeoutException:
- error = self.timeout_msg
+ error.append(self.timeout_msg)
except OSError:
msg = traceback.format_exc(limit=0)
- error = "Error: {0}".format(msg)
- except Exception as e:
+ error.append("Error: {0}".format(msg))
+ except Exception:
exc_type, exc_value, exc_tb = sys.exc_info()
tb_list = traceback.format_exception(exc_type, exc_value, exc_tb)
if len(tb_list) > 2:
del tb_list[1:3]
- error = "Error: {0}".format("".join(tb_list))
+ error.append("Error: {0}".format("".join(tb_list)))
finally:
# Set back any original signal handler.
set_original_signal_handler(prev_handler)