diff options
author | maheshgudi | 2016-08-03 15:16:08 +0530 |
---|---|---|
committer | maheshgudi | 2016-08-03 15:16:08 +0530 |
commit | 40fbb5d8f1d4174f7d7e2d4723e9fbfc40040dcb (patch) | |
tree | 7885b674d2deb064137f1f501ed1707bfd54daf8 /yaksh/python_assertion_evaluator.py | |
parent | 1b71abc9437d721a41f017db406f312755f5a4c4 (diff) | |
parent | 2b03aeb36fa333ea1644a248c742cf0c1df12a5f (diff) | |
download | online_test-40fbb5d8f1d4174f7d7e2d4723e9fbfc40040dcb.tar.gz online_test-40fbb5d8f1d4174f7d7e2d4723e9fbfc40040dcb.tar.bz2 online_test-40fbb5d8f1d4174f7d7e2d4723e9fbfc40040dcb.zip |
rebase changes with stdio evaluator
Diffstat (limited to 'yaksh/python_assertion_evaluator.py')
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index bf6a4be..04a4e69 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -7,6 +7,7 @@ import importlib # local imports from code_evaluator import CodeEvaluator, TimeoutException +from file_utils import copy_files, delete_files class PythonAssertionEvaluator(CodeEvaluator): @@ -16,7 +17,16 @@ class PythonAssertionEvaluator(CodeEvaluator): super(PythonAssertionEvaluator, self).setup() self.exec_scope = None - def compile_code(self, user_answer, test_case): + def teardown(self): + super(PythonAssertionEvaluator, self).teardown() + # Delete the created file. + if self.files: + delete_files(self.files) + + def compile_code(self, user_answer, file_paths, test_case): + self.files = [] + if file_paths: + self.files = copy_files(file_paths) if self.exec_scope: return None else: @@ -25,7 +35,7 @@ class PythonAssertionEvaluator(CodeEvaluator): exec submitted in self.exec_scope return self.exec_scope - def check_code(self, user_answer, test_case): + def check_code(self, user_answer, file_paths, test_case): success = False try: tb = None @@ -42,6 +52,5 @@ class PythonAssertionEvaluator(CodeEvaluator): else: success = True err = 'Correct answer' - del tb return success, err |