[pypy-svn] r72650 - pypy/trunk/pypy/module/_socket/test

getxsick at codespeak.net getxsick at codespeak.net
Tue Mar 23 20:47:04 CET 2010


Author: getxsick
Date: Tue Mar 23 20:47:02 2010
New Revision: 72650

Modified:
   pypy/trunk/pypy/module/_socket/test/test_sock_app.py
Log:
Skip tests for GAIErrors. That helps with failing when there is no connection.
In these tests we don't investigate getaddrinfo() / getnameinfo() (there are
appropriate unit tests for these functions). Life is good.

However XXX section is still alive..


Modified: pypy/trunk/pypy/module/_socket/test/test_sock_app.py
==============================================================================
--- pypy/trunk/pypy/module/_socket/test/test_sock_app.py	(original)
+++ pypy/trunk/pypy/module/_socket/test/test_sock_app.py	Tue Mar 23 20:47:02 2010
@@ -314,9 +314,12 @@
         import _socket, os
         s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM, 0)
         # XXX temporarily we use codespeak to test, will have more robust tests in
-        # the absence of a network connection later when mroe parts of the socket
-        # API are implemented.
-        s.connect(("codespeak.net", 80))
+        # the absence of a network connection later when more parts of the socket
+        # API are implemented. currently skip the test if there is no connection.
+        try:
+            s.connect(("codespeak.net", 80))
+        except _socket.gaierror, ex:
+            skip("GAIError - probably no connection: %s" % str(ex.args))
         name = s.getpeername() # Will raise socket.error if not connected
         assert name[1] == 80
         s.close()
@@ -399,9 +402,12 @@
         import _socket, os
         s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM, 0)
         # XXX temporarily we use codespeak to test, will have more robust tests in
-        # the absence of a network connection later when mroe parts of the socket
-        # API are implemented.
-        s.connect(("codespeak.net", 80))
+        # the absence of a network connection later when more parts of the socket
+        # API are implemented. currently skip the test if there is no connection.
+        try:
+            s.connect(("codespeak.net", 80))
+        except _socket.gaierror, ex:
+            skip("GAIError - probably no connection: %s" % str(ex.args))
         s.send(buffer(''))
         s.sendall(buffer(''))
         s.send(u'')



More information about the Pypy-commit mailing list