diff options
Diffstat (limited to 'yaksh/tests/test_code_server.py')
-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..8835110 100644 --- a/yaksh/tests/test_code_server.py +++ b/yaksh/tests/test_code_server.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals 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' |