Python 3 migrate SocketServer

This commit is contained in:
Matthias Kuhn 2016-04-14 13:38:55 +02:00
parent 3e300f2966
commit 4af3f82bd0
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ __revision__ = '$Format:%H$'
import qgis # NOQA import qgis # NOQA
import os import os
import SocketServer import socketserver
import threading import threading
import SimpleHTTPServer import SimpleHTTPServer
from PyQt.QtCore import QRectF from PyQt.QtCore import QRectF
@ -40,7 +40,7 @@ class TestQgsComposerPicture(unittest.TestCase):
os.chdir(unitTestDataPath() + '') os.chdir(unitTestDataPath() + '')
handler = SimpleHTTPServer.SimpleHTTPRequestHandler handler = SimpleHTTPServer.SimpleHTTPRequestHandler
cls.httpd = SocketServer.TCPServer(('localhost', 0), handler) cls.httpd = socketserver.TCPServer(('localhost', 0), handler)
cls.port = cls.httpd.server_address[1] cls.port = cls.httpd.server_address[1]
cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever) cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)

View File

@ -20,9 +20,9 @@ from qgis.core import QgsNetworkContentFetcher
from utilities import unitTestDataPath from utilities import unitTestDataPath
from PyQt.QtCore import QUrl, QCoreApplication from PyQt.QtCore import QUrl, QCoreApplication
from PyQt.QtNetwork import QNetworkReply from PyQt.QtNetwork import QNetworkReply
import SocketServer import socketserver
import threading import threading
import SimpleHTTPServer import http.server
class TestQgsNetworkContentFetcher(unittest.TestCase): class TestQgsNetworkContentFetcher(unittest.TestCase):
@ -31,9 +31,9 @@ class TestQgsNetworkContentFetcher(unittest.TestCase):
def setUpClass(cls): def setUpClass(cls):
# Bring up a simple HTTP server # Bring up a simple HTTP server
os.chdir(unitTestDataPath() + '') os.chdir(unitTestDataPath() + '')
handler = SimpleHTTPServer.SimpleHTTPRequestHandler handler = http.server.SimpleHTTPRequestHandler
cls.httpd = SocketServer.TCPServer(('localhost', 0), handler) cls.httpd = socketserver.TCPServer(('localhost', 0), handler)
cls.port = cls.httpd.server_address[1] cls.port = cls.httpd.server_address[1]
cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever) cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)