From: Charles-François Natali Date: Sun, 13 Jan 2013 13:08:01 +0000 (+0100) Subject: test_asyncore: wait explicitly for a thread termination (this dangling thread X-Git-Tag: v3.3.1rc1~365^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ea12ff04dad589807257f258aa5c3758c924a0d;p=python test_asyncore: wait explicitly for a thread termination (this dangling thread could be the cause of a random failure). --- 1ea12ff04dad589807257f258aa5c3758c924a0d diff --cc Lib/test/test_asyncore.py index 4ae16eb1cc,8989a632e8..878b26cb71 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@@ -784,14 -735,13 +784,14 @@@ class BaseTestAPI @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() - self.addCleanup(t.join) - - for x in range(20): - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + 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() - ++ self.addCleanup(t.join) + + s = socket.socket(self.family, socket.SOCK_STREAM) s.settimeout(.2) s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))