summaryrefslogtreecommitdiff
path: root/yaksh/bash_code_evaluator.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/bash_code_evaluator.py')
-rw-r--r--yaksh/bash_code_evaluator.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/yaksh/bash_code_evaluator.py b/yaksh/bash_code_evaluator.py
index c602ceb..bce7f07 100644
--- a/yaksh/bash_code_evaluator.py
+++ b/yaksh/bash_code_evaluator.py
@@ -9,7 +9,7 @@ import importlib
# local imports
from code_evaluator import CodeEvaluator
-from copy_delete_files import CopyDeleteFiles
+from file_utils import copy_files, delete_files
class BashCodeEvaluator(CodeEvaluator):
@@ -23,9 +23,8 @@ class BashCodeEvaluator(CodeEvaluator):
# Delete the created file.
super(BashCodeEvaluator, self).teardown()
os.remove(self.submit_code_path)
- if self.files_list:
- file_delete = CopyDeleteFiles()
- file_delete.delete_files(self.files_list)
+ if self.files:
+ delete_files(self.files)
def check_code(self, user_answer, file_paths, test_case):
""" Function validates student script using instructor script as
@@ -57,10 +56,9 @@ class BashCodeEvaluator(CodeEvaluator):
clean_ref_code_path, clean_test_case_path = \
self._set_test_code_file_path(get_ref_path, get_test_case_path)
- self.files_list = []
+ self.files = []
if file_paths:
- file_copy = CopyDeleteFiles()
- self.files_list = file_copy.copy_files(file_paths)
+ self.files = copy_files(file_paths)
if not isfile(clean_ref_code_path):
msg = "No file at %s or Incorrect path" % clean_ref_code_path
return False, msg
@@ -123,12 +121,8 @@ class BashCodeEvaluator(CodeEvaluator):
stderr=subprocess.PIPE
)
proc, inst_stdout, inst_stderr = ret
- if self.files_list:
- file_delete = CopyDeleteFiles()
- file_delete.delete_files(self.files_list)
if file_paths:
- file_copy = CopyDeleteFiles()
- self.files_list = file_copy.copy_files(file_paths)
+ self.files = copy_files(file_paths)
args = [self.submit_code_path] + \
[x for x in test_case.split()]
ret = self._run_command(args,