aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2020-04-23 10:39:09 -0700
committerUlrich Müller <ulm@gentoo.org>2021-05-04 17:48:08 +0200
commit20fe069692a9818c41059c3ebcfef3dce39c258e (patch)
treee6ab84a0a3e4c1e1c1667cbd34a55ebd66e3b63a
parenttest_DBGenerator.py, test_PackageDB.py: Fix test errors (diff)
downloadg-sorcery-20fe069692a9818c41059c3ebcfef3dce39c258e.tar.gz
g-sorcery-20fe069692a9818c41059c3ebcfef3dce39c258e.tar.bz2
g-sorcery-20fe069692a9818c41059c3ebcfef3dce39c258e.zip
tests/server/py: Fix an inheritence error in py 3.7, 3.8
self.directory was being overridden by the super class instance. Rename this local variable to prevent it being overridden. Signed-off-by: Brian Dolbec <dolsen@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--tests/server.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/server.py b/tests/server.py
index 6a32a2d..aa895ea 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -4,9 +4,9 @@
"""
server.py
~~~~~~~~~
-
+
test server
-
+
:copyright: (c) 2013 by Jauhien Piatlicki
:license: GPL-2, see LICENSE for more details.
"""
@@ -18,7 +18,7 @@ import time
from g_sorcery.compatibility import py2k
if py2k:
- from SocketServer import TCPServer as HTTPServer
+ from SocketServer import TCPServer as HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
else:
from http.server import HTTPServer
@@ -27,24 +27,24 @@ else:
def HTTPRequestHandlerGenerator(direct):
class HTTPRequestHandler(SimpleHTTPRequestHandler, object):
- directory = direct
def __init__(self, request, client_address, server):
+ self.direct = direct
super(HTTPRequestHandler, self).__init__(request, client_address, server)
def translate_path(self, path):
- return os.path.join(self.directory, path[1:])
+ return os.path.join(self.direct, path[1:])
return HTTPRequestHandler
-
+
class Server(threading.Thread):
def __init__(self, directory, port=8080):
super(Server, self).__init__()
HTTPServer.allow_reuse_address = True
server_address = ('127.0.0.1', port)
self.httpd = HTTPServer(server_address, HTTPRequestHandlerGenerator(directory))
-
+
def run(self):
self.httpd.serve_forever()