diff options
author | ankitjavalkar | 2015-04-23 19:32:37 +0530 |
---|---|---|
committer | ankitjavalkar | 2015-04-26 19:46:01 +0530 |
commit | 17752a69114e7dbad266337e768013920aec8c0c (patch) | |
tree | 7f88fe72bda2dfca49e0032888fb0cb01cc73d1a /testapp/exam/evaluate_scilab.py | |
parent | 0580f99fecc0bb495beb5706e18246834174710b (diff) | |
download | online_test-17752a69114e7dbad266337e768013920aec8c0c.tar.gz online_test-17752a69114e7dbad266337e768013920aec8c0c.tar.bz2 online_test-17752a69114e7dbad266337e768013920aec8c0c.zip |
Code Review: Code refactoring
- Add from_json classmethod
- Question language is passed directly to the code server
- Fix errors in evaluation of code
- Fix test cases
Diffstat (limited to 'testapp/exam/evaluate_scilab.py')
-rw-r--r-- | testapp/exam/evaluate_scilab.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/testapp/exam/evaluate_scilab.py b/testapp/exam/evaluate_scilab.py index 1874cf6..f4253ff 100644 --- a/testapp/exam/evaluate_scilab.py +++ b/testapp/exam/evaluate_scilab.py @@ -7,21 +7,21 @@ import re import importlib # local imports -from code_server import TestCode -from registry import registryz +from test_code import TestCode +from registry import registry class EvaluateScilab(TestCode): """Tests the Scilab code obtained from Code Server""" # def evaluate_scilab_code(self): def evaluate_code(self): - submit_path = self._create_submit_code_file('function.sci') - ref_path, test_case_path = self._set_test_code_file_path() + submit_path = self.create_submit_code_file('function.sci') + ref_path, test_case_path = self.set_test_code_file_path() success = False cmd = 'printf "lines(0)\nexec(\'{0}\',2);\nquit();"'.format(ref_path) cmd += ' | timeout 8 scilab-cli -nb' - ret = self._run_command(cmd, + ret = self.run_command(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -44,6 +44,7 @@ class EvaluateScilab(TestCode): return success, err + # Private Protocol def _remove_scilab_exit(self, string): """ Removes exit, quit and abort from the scilab code @@ -79,4 +80,4 @@ class EvaluateScilab(TestCode): strip_out = strip_out+"\n"+l.strip() return strip_out -registry.register('scilab', evaluate_scilab, EvaluateScilab)
\ No newline at end of file +registry.register('scilab', EvaluateScilab)
\ No newline at end of file |