aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-02 16:49:51 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-02 16:49:51 +0200
commitab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef (patch)
tree8b2680c39c9f6c10f75134114df32005fba903d4 /tests
parentpy2: TemporaryDirectory (diff)
downloadg-sorcery-ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef.tar.gz
g-sorcery-ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef.tar.bz2
g-sorcery-ab7e4b9f72ac3fcf90a04d1743a2823e431ed0ef.zip
py2k: tests/server
Diffstat (limited to 'tests')
-rw-r--r--tests/server.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/server.py b/tests/server.py
index ef17849..41767fc 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -11,13 +11,23 @@
:license: GPL-2, see LICENSE for more details.
"""
-import http.server, threading
+import threading
+
+from g_sorcery.compatibility import py2k
+
+if py2k:
+ from SocketServer import TCPServer as HTTPServer
+ from SimpleHTTPServer import SimpleHTTPRequestHandler
+else:
+ from http.server import HTTPServer
+ from http.server import SimpleHTTPRequestHandler
class Server(threading.Thread):
def __init__(self):
super(Server, self).__init__()
+ HTTPServer.allow_reuse_address = True
server_address = ('127.0.0.1', 8080)
- self.httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
+ self.httpd = HTTPServer(server_address, SimpleHTTPRequestHandler)
def run(self):
self.httpd.serve_forever()