From 4af3f82bd06e4890b1db46b099420b85d887194f Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Thu, 14 Apr 2016 13:38:55 +0200 Subject: [PATCH] Python 3 migrate SocketServer --- tests/src/python/test_qgscomposerpicture.py | 4 ++-- tests/src/python/test_qgsnetworkcontentfetcher.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/src/python/test_qgscomposerpicture.py b/tests/src/python/test_qgscomposerpicture.py index 538a0fa8be3..08e00b814f8 100644 --- a/tests/src/python/test_qgscomposerpicture.py +++ b/tests/src/python/test_qgscomposerpicture.py @@ -15,7 +15,7 @@ __revision__ = '$Format:%H$' import qgis # NOQA import os -import SocketServer +import socketserver import threading import SimpleHTTPServer from PyQt.QtCore import QRectF @@ -40,7 +40,7 @@ class TestQgsComposerPicture(unittest.TestCase): os.chdir(unitTestDataPath() + '') 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.httpd_thread = threading.Thread(target=cls.httpd.serve_forever) diff --git a/tests/src/python/test_qgsnetworkcontentfetcher.py b/tests/src/python/test_qgsnetworkcontentfetcher.py index 927ae3bbd3b..cdbbb145a8b 100644 --- a/tests/src/python/test_qgsnetworkcontentfetcher.py +++ b/tests/src/python/test_qgsnetworkcontentfetcher.py @@ -20,9 +20,9 @@ from qgis.core import QgsNetworkContentFetcher from utilities import unitTestDataPath from PyQt.QtCore import QUrl, QCoreApplication from PyQt.QtNetwork import QNetworkReply -import SocketServer +import socketserver import threading -import SimpleHTTPServer +import http.server class TestQgsNetworkContentFetcher(unittest.TestCase): @@ -31,9 +31,9 @@ class TestQgsNetworkContentFetcher(unittest.TestCase): def setUpClass(cls): # Bring up a simple HTTP server 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.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)