[Python-checkins] cpython: fix failing asyncore test as per http://bugs.python.org/issue10340#msg156586

giampaolo.rodola python-checkins at python.org
Fri Mar 23 13:30:02 CET 2012


http://hg.python.org/cpython/rev/e35a5bbb0b91
changeset:   75895:e35a5bbb0b91
parent:      75893:9ceac471bd8c
user:        Giampaolo Rodola' <g.rodola at gmail.com>
date:        Fri Mar 23 13:29:01 2012 +0100
summary:
  fix failing asyncore test as per http://bugs.python.org/issue10340#msg156586

files:
  Lib/test/test_asyncore.py |  20 +++++++++++---------
  1 files changed, 11 insertions(+), 9 deletions(-)


diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -783,16 +783,18 @@
     @support.reap_threads
     def test_quick_connect(self):
         # see: http://bugs.python.org/issue10340
-        server = TCPServer()
-        t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500))
-        t.start()
+        if self.family in (socket.AF_INET, getattr(socket, "AF_INET6", object())):
+            server = BaseServer(self.family, self.addr)
+            t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1,
+                                                              count=500))
+            t.start()
 
-        for x in range(20):
-            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
-                         struct.pack('ii', 1, 0))
-            s.connect(server.address)
-            s.close()
+            for x in range(20):
+                s = socket.socket(self.family, socket.SOCK_STREAM)
+                s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
+                             struct.pack('ii', 1, 0))
+                s.connect(server.address)
+                s.close()
 
 
 class TestAPI_UseIPv4Sockets(BaseTestAPI):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list