diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py index 982c12b1..9d1f6f21 100644 --- a/yaksh/evaluator_tests/test_python_evaluation.py +++ b/yaksh/evaluator_tests/test_python_evaluation.py @@ -18,9 +18,6 @@ def assert_correct_output(self, expected_output, actual_output): class PythonAssertionEvaluationTestCases(EvaluatorBaseTest): def setUp(self): - self.tmp_file = os.path.join(tempfile.gettempdir(), "test.txt") - with open(self.tmp_file, 'wb') as f: - f.write('2'.encode('ascii')) tmp_in_dir_path = tempfile.mkdtemp() self.in_dir = tmp_in_dir_path self.test_case_data = [{"test_case_type": "standardtestcase", @@ -927,41 +924,5 @@ def check_answer(user_answer): result.get("error")[0]["message"] ) - def test_assignment_upload(self): - # Given - user_answer = "Assignment Upload" - hook_code = dedent("""\ - def check_answer(user_answer): - success = False - err = "Incorrect Answer" - mark_fraction = 0.0 - with open("test.txt") as f: - data = f.read() - if data == '2': - success, err, mark_fraction = True, "", 1.0 - return success, err, mark_fraction - """ - ) - - test_case_data = [{"test_case_type": "hooktestcase", - "hook_code": hook_code, "weight": 1.0 - }] - kwargs = {'metadata': { - 'user_answer': user_answer, - 'file_paths': self.file_paths, - 'assign_files': [self.tmp_file], - 'partial_grading': False, - 'language': 'python'}, - 'test_case_data': test_case_data, - } - - # When - grader = Grader(self.in_dir) - result = grader.evaluate(kwargs) - - # Then - self.assertTrue(result.get('success')) - - if __name__ == '__main__': unittest.main() diff --git a/yaksh/evaluator_tests/test_r_evaluation.py b/yaksh/evaluator_tests/test_r_evaluation.py index a196d91c..7b8a51e2 100644 --- a/yaksh/evaluator_tests/test_r_evaluation.py +++ b/yaksh/evaluator_tests/test_r_evaluation.py @@ -46,9 +46,8 @@ def setUp(self): "test_case_type": "standardtestcase", "weight": 0.0, "hidden": True }] - self.timeout_msg = ("Code took more than {0} seconds to run. " - "You probably have an infinite loop in" - " your code.").format(SERVER_TIMEOUT) + self.timeout_msg = ("You probably have an infinite loop in" + " your code.") self.file_paths = None def tearDown(self): diff --git a/yaksh/tasks.py b/yaksh/tasks.py index 645eea27..6fa4119d 100644 --- a/yaksh/tasks.py +++ b/yaksh/tasks.py @@ -222,7 +222,7 @@ def send_files_to_code_server(data): files = [file.get_filename() for file in uploads] data = {"files": files, "action": action, "path": path} response = requests.post(post_url, data=data) + message = response.content if response.status_code == 200: - print("Successfully downloaded/deleted files") - else: - print("Download failed\n", response.content) + message = "Successfully downloaded/deleted files" + return message