summaryrefslogtreecommitdiff
path: root/yaksh/code_evaluator.py
diff options
context:
space:
mode:
authorKing2016-07-28 17:39:44 +0530
committerGitHub2016-07-28 17:39:44 +0530
commit2b03aeb36fa333ea1644a248c742cf0c1df12a5f (patch)
tree4c753ba9a1fbccf3e06d1ed1d998137c88a73b88 /yaksh/code_evaluator.py
parent344e1e804cee214c0d0f5c41ca16d871e786d4c3 (diff)
parent83bee9d89e163e98504c8aa210ce60200bd1cd1d (diff)
downloadonline_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.tar.gz
online_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.tar.bz2
online_test-2b03aeb36fa333ea1644a248c742cf0c1df12a5f.zip
Merge pull request #113 from adityacp/file_based_questions
File based questions
Diffstat (limited to 'yaksh/code_evaluator.py')
-rw-r--r--yaksh/code_evaluator.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py
index aab99eb..2fb429f 100644
--- a/yaksh/code_evaluator.py
+++ b/yaksh/code_evaluator.py
@@ -88,7 +88,7 @@ class CodeEvaluator(object):
def setup(self):
self._change_dir(self.in_dir)
- def safe_evaluate(self, user_answer, test_case_data):
+ def safe_evaluate(self, user_answer, test_case_data, file_paths=None):
"""
Handles code evaluation along with compilation, signal handling
and Exception handling
@@ -101,8 +101,8 @@ class CodeEvaluator(object):
# Do whatever testing needed.
try:
for test_case in test_case_data:
- self.compile_code(user_answer, **test_case)
- success, err = self.check_code(user_answer, **test_case)
+ self.compile_code(user_answer, file_paths, **test_case)
+ success, err = self.check_code(user_answer, file_paths, **test_case)
if not success:
break
@@ -124,7 +124,7 @@ class CodeEvaluator(object):
def check_code(self):
raise NotImplementedError("check_code method not implemented")
- def compile_code(self, user_answer, **kwargs):
+ def compile_code(self, user_answer, file_paths, **kwargs):
pass
def create_submit_code_file(self, file_name):
@@ -136,7 +136,6 @@ class CodeEvaluator(object):
return submit_path
-
def write_to_submit_code_file(self, file_path, user_answer):
""" Write the code (`answer`) to a file"""
submit_f = open(file_path, 'w')