summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-10-06 11:39:47 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-10-06 15:43:32 -0300
commit7ccc40dd7c0ebe8d86349dc1f9cc9b496d9fd7d2 (patch)
treed06dc8132ff7ba5f85b3fc50680282ec2b9c525f
parent78540b73645110a155510f1cd4fa2b9feea9c34c (diff)
downloadpyside-7ccc40dd7c0ebe8d86349dc1f9cc9b496d9fd7d2.tar.gz
pyside-7ccc40dd7c0ebe8d86349dc1f9cc9b496d9fd7d2.tar.xz
pyside-7ccc40dd7c0ebe8d86349dc1f9cc9b496d9fd7d2.zip
Updated QtNetwork modue to works with python 2.x and 3.x
-rw-r--r--tests/QtNetwork/basic_auth_test.py6
-rw-r--r--tests/util/httpd.py12
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/QtNetwork/basic_auth_test.py b/tests/QtNetwork/basic_auth_test.py
index bc41d65..3a78e9a 100644
--- a/tests/QtNetwork/basic_auth_test.py
+++ b/tests/QtNetwork/basic_auth_test.py
@@ -26,7 +26,7 @@ class testAuthenticationSignal(UsesQCoreApplication):
self.httpd = None
def onAuthRequest(self, hostname, port, auth):
- self.assert_(isinstance(auth, QAuthenticator))
+ self.assertTrue(isinstance(auth, QAuthenticator))
self._resultOk = True
self.goAway()
@@ -36,7 +36,7 @@ class testAuthenticationSignal(UsesQCoreApplication):
path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
data = http.get(str(path))
self.app.exec_()
- self.assert_(self._resultOk)
+ self.assertTrue(self._resultOk)
def testwaitSignal2(self):
http = QHttp('127.0.0.1', self.httpd.port())
@@ -45,7 +45,7 @@ class testAuthenticationSignal(UsesQCoreApplication):
path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
data = http.get(str(path))
self.app.exec_()
- self.assert_(self._resultOk)
+ self.assertTrue(self._resultOk)
if __name__ == '__main__':
unittest.main()
diff --git a/tests/util/httpd.py b/tests/util/httpd.py
index 723a5dc..71ca59f 100644
--- a/tests/util/httpd.py
+++ b/tests/util/httpd.py
@@ -1,10 +1,16 @@
-import SocketServer
-import BaseHTTPServer
import os
import sys
import threading
import select
import random
+import py3kcompat as py3k
+
+if py3k.IS_PY3K:
+ import socketserver as SocketServer
+ import http.server as BaseHTTPServer
+else:
+ import SocketServer
+ import BaseHTTPServer
class TestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
DATA = "PySide Server"
@@ -29,7 +35,7 @@ class TestSecureHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
self.send_head()
- self.wfile.write(TestHandler.DATA)
+ self.wfile.write(py3k.b(TestHandler.DATA))
def do_HEAD(self):
self.send_head()