From ac8d6720bc75676e05462cc38ad144d5aedc14e7 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Wed, 21 Sep 2016 15:07:43 +0530 Subject: Migrate python code server and evaluators to python 2/3 compatible --- yaksh/java_code_evaluator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'yaksh/java_code_evaluator.py') diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py index ff76317..2e8c0c6 100644 --- a/yaksh/java_code_evaluator.py +++ b/yaksh/java_code_evaluator.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +from __future__ import absolute_import import traceback import pwd import os @@ -6,9 +7,9 @@ from os.path import join, isfile import subprocess import importlib -# local imports -from code_evaluator import CodeEvaluator -from file_utils import copy_files, delete_files +# Local imports +from .code_evaluator import CodeEvaluator +from .file_utils import copy_files, delete_files class JavaCodeEvaluator(CodeEvaluator): -- cgit From 6b6e58b06bd49e36edd87a027c08d223571a0c0b Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Tue, 27 Sep 2016 15:08:18 +0530 Subject: Fix test cases and corresponding changes in evaluators for Python 2/3 compatibility --- yaksh/java_code_evaluator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'yaksh/java_code_evaluator.py') diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py index 2e8c0c6..a294b8e 100644 --- a/yaksh/java_code_evaluator.py +++ b/yaksh/java_code_evaluator.py @@ -19,9 +19,10 @@ class JavaCodeEvaluator(CodeEvaluator): self.submit_code_path = self.create_submit_code_file('Test.java') self.compiled_user_answer = None self.compiled_test_code = None + self.user_output_path = "" + self.ref_output_path = "" def teardown(self): - super(JavaCodeEvaluator, self).teardown() # Delete the created file. os.remove(self.submit_code_path) if os.path.exists(self.user_output_path): @@ -30,6 +31,8 @@ class JavaCodeEvaluator(CodeEvaluator): os.remove(self.ref_output_path) if self.files: delete_files(self.files) + super(JavaCodeEvaluator, self).teardown() + def get_commands(self, clean_ref_code_path, user_code_directory): compile_command = 'javac {0}'.format(self.submit_code_path), -- cgit From cb0569a32422a195d4165ef405ac5560024dabda Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 29 Sep 2016 18:10:09 +0530 Subject: Add unicode_literal import for Python2 --- yaksh/java_code_evaluator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/java_code_evaluator.py') diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py index a294b8e..1ce1c0e 100644 --- a/yaksh/java_code_evaluator.py +++ b/yaksh/java_code_evaluator.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import absolute_import +from __future__ import unicode_literals import traceback import pwd import os -- cgit