diff options
author | mahesh | 2017-04-27 12:51:10 +0530 |
---|---|---|
committer | mahesh | 2017-04-27 12:51:10 +0530 |
commit | 4a8f9a117f6a784fe722b8b381368c41be86024a (patch) | |
tree | 3bceb7e437fbb7cb4dd73813f33c1502f6691de9 | |
parent | c431c255738b741698adffcbf894930ae298b8c0 (diff) | |
download | online_test-4a8f9a117f6a784fe722b8b381368c41be86024a.tar.gz online_test-4a8f9a117f6a784fe722b8b381368c41be86024a.tar.bz2 online_test-4a8f9a117f6a784fe722b8b381368c41be86024a.zip |
made pep8 changes
-rw-r--r-- | yaksh/evaluator_tests/test_bash_evaluation.py | 11 | ||||
-rw-r--r-- | yaksh/evaluator_tests/test_c_cpp_evaluation.py | 14 | ||||
-rw-r--r-- | yaksh/evaluator_tests/test_java_evaluation.py | 13 | ||||
-rw-r--r-- | yaksh/evaluator_tests/test_scilab_evaluation.py | 9 | ||||
-rw-r--r-- | yaksh/stdio_evaluator.py | 4 |
5 files changed, 25 insertions, 26 deletions
diff --git a/yaksh/evaluator_tests/test_bash_evaluation.py b/yaksh/evaluator_tests/test_bash_evaluation.py index 352e95f..8bb8c81 100644 --- a/yaksh/evaluator_tests/test_bash_evaluation.py +++ b/yaksh/evaluator_tests/test_bash_evaluation.py @@ -107,10 +107,8 @@ class BashAssertionEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) - - + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) def test_file_based_assert(self): # Given @@ -538,9 +536,8 @@ class BashHookEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get('error')) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) - + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) if __name__ == '__main__': diff --git a/yaksh/evaluator_tests/test_c_cpp_evaluation.py b/yaksh/evaluator_tests/test_c_cpp_evaluation.py index 79227f5..b15f766 100644 --- a/yaksh/evaluator_tests/test_c_cpp_evaluation.py +++ b/yaksh/evaluator_tests/test_c_cpp_evaluation.py @@ -154,9 +154,8 @@ class CAssertionEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) - + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) def test_file_based_assert(self): # Given @@ -409,8 +408,8 @@ class CppStdIOEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) def test_only_stdout(self): # Given @@ -979,8 +978,9 @@ class CppHookEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get('error')) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) + if __name__ == '__main__': unittest.main() diff --git a/yaksh/evaluator_tests/test_java_evaluation.py b/yaksh/evaluator_tests/test_java_evaluation.py index 39c5ee9..ea558ed 100644 --- a/yaksh/evaluator_tests/test_java_evaluation.py +++ b/yaksh/evaluator_tests/test_java_evaluation.py @@ -163,8 +163,8 @@ class JavaAssertionEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) def test_file_based_assert(self): # Given @@ -407,9 +407,8 @@ class JavaStdIOEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) - + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) def test_only_stdout(self): # Given @@ -849,8 +848,8 @@ class JavaHookEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get('error')) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) if __name__ == '__main__': diff --git a/yaksh/evaluator_tests/test_scilab_evaluation.py b/yaksh/evaluator_tests/test_scilab_evaluation.py index 1792937..c3a1c83 100644 --- a/yaksh/evaluator_tests/test_scilab_evaluation.py +++ b/yaksh/evaluator_tests/test_scilab_evaluation.py @@ -3,12 +3,14 @@ import unittest import os import shutil import tempfile +from psutil import Process from textwrap import dedent + +#Local Import from yaksh import grader as gd from yaksh.grader import Grader from yaksh.scilab_code_evaluator import ScilabCodeEvaluator from yaksh.evaluator_tests.test_python_evaluation import EvaluatorBaseTest -from psutil import Process class ScilabEvaluationTestCases(EvaluatorBaseTest): def setUp(self): @@ -138,8 +140,9 @@ class ScilabEvaluationTestCases(EvaluatorBaseTest): self.assert_correct_output(self.timeout_msg, result.get("error")) parent_proc = Process(os.getpid()).children() if parent_proc: - self.assertFalse(any(Process(parent_proc[0].pid)\ - .children(recursive=True))) + children_procs = Process(parent_proc[0].pid) + self.assertFalse(any(children_procs.children(recursive=True))) + if __name__ == '__main__': unittest.main() diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py index ec69851..554d4c5 100644 --- a/yaksh/stdio_evaluator.py +++ b/yaksh/stdio_evaluator.py @@ -1,10 +1,10 @@ from __future__ import unicode_literals +import os +import signal # Local imports from .base_evaluator import BaseEvaluator from .grader import TimeoutException -import os -import signal class StdIOEvaluator(BaseEvaluator): |