diff options
author | prathamesh | 2016-09-23 14:29:05 +0530 |
---|---|---|
committer | prathamesh | 2016-09-23 14:29:05 +0530 |
commit | 752b578cb5204a9a3cd91c2257ddd201d67c3c12 (patch) | |
tree | e8d4c3dd1dec90897c960a104b766597fb8cc3aa /yaksh | |
parent | 0f56337922344562482b85f89eff0f9b061bf8c4 (diff) | |
download | online_test-752b578cb5204a9a3cd91c2257ddd201d67c3c12.tar.gz online_test-752b578cb5204a9a3cd91c2257ddd201d67c3c12.tar.bz2 online_test-752b578cb5204a9a3cd91c2257ddd201d67c3c12.zip |
need to start code server for model tests.
While testing regrade method for code questions, code server needs to
serve.
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/test_models.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index bce2b1b..3909652 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -2,6 +2,9 @@ import unittest from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\ StdioBasedTestCase, FileUpload, McqTestCase +from yaksh.code_server import ServerPool, SERVER_POOL_PORT +from yaksh import settings +from yaksh.xmlrpc_clients import CodeServerProxy import json from datetime import datetime, timedelta from django.utils import timezone @@ -12,6 +15,7 @@ import zipfile import os import shutil import tempfile +from threading import Thread def setUpModule(): # create user profile @@ -519,6 +523,22 @@ class AnswerPaperTestCases(unittest.TestCase): ) self.mcc_based_testcase.save() + settings.code_evaluators['python']['standardtestcase'] = \ + "yaksh.python_assertion_evaluator.PythonAssertionEvaluator" + ports = range(9001, 9002) + server_pool = ServerPool(ports=ports, pool_port=SERVER_POOL_PORT) + self.server_pool = server_pool + self.server_thread = t = Thread(target=server_pool.run) + t.start() + self.code_server = CodeServerProxy() + + @classmethod + def tearDownClass(self): + self.server_pool.stop() + self.server_thread.join() + settings.code_evaluators['python']['standardtestcase'] = \ + "python_assertion_evaluator.PythonAssertionEvaluator" + def test_validate_and_regrade_mcc_question(self): # Given mcc_answer = ['a'] |