diff options
author | ankitjavalkar | 2016-09-21 15:07:43 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-09-30 10:33:42 +0530 |
commit | ac8d6720bc75676e05462cc38ad144d5aedc14e7 (patch) | |
tree | e2e527e159a0704ecdaa2f15ae13900f4555ea63 /yaksh/tests | |
parent | 6b08e56fe3cf70ffbcbd1ed432dde25babe48148 (diff) | |
download | online_test-ac8d6720bc75676e05462cc38ad144d5aedc14e7.tar.gz online_test-ac8d6720bc75676e05462cc38ad144d5aedc14e7.tar.bz2 online_test-ac8d6720bc75676e05462cc38ad144d5aedc14e7.zip |
Migrate python code server and evaluators to python 2/3 compatible
Diffstat (limited to 'yaksh/tests')
-rw-r--r-- | yaksh/tests/test_code_server.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/yaksh/tests/test_code_server.py b/yaksh/tests/test_code_server.py index a73f073..1d6584b 100644 --- a/yaksh/tests/test_code_server.py +++ b/yaksh/tests/test_code_server.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import import json try: from Queue import Queue @@ -5,7 +6,7 @@ except ImportError: from queue import Queue from threading import Thread import unittest -import urllib +from six.moves import urllib from yaksh.code_server import ServerPool, SERVER_POOL_PORT from yaksh import settings @@ -18,7 +19,7 @@ class TestCodeServer(unittest.TestCase): def setUpClass(cls): settings.code_evaluators['python']['standardtestcase'] = \ "yaksh.python_assertion_evaluator.PythonAssertionEvaluator" - ports = range(8001, 8006) + ports = range(8001, 8006) server_pool = ServerPool(ports=ports, pool_port=SERVER_POOL_PORT) cls.server_pool = server_pool cls.server_thread = t = Thread(target=server_pool.run) @@ -117,7 +118,8 @@ class TestCodeServer(unittest.TestCase): url = "http://localhost:%s/status"%SERVER_POOL_PORT # When - data = urllib.urlopen(url).read() + response = urllib.request.urlopen(url) + data = response.read().decode('utf-8') # Then expect = 'out of 5 are free' |