Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 466a54f

Browse files
committed
fix failing asyncore test as per http://bugs.python.org/issue10340#msg156586
1 parent 42243c4 commit 466a54f

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

Lib/test/test_asyncore.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -783,16 +783,18 @@ def test_set_reuse_addr(self):
783783
@support.reap_threads
784784
def test_quick_connect(self):
785785
# see: http://bugs.python.org/issue10340
786-
server = TCPServer()
787-
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500))
788-
t.start()
789-
790-
for x in range(20):
791-
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
792-
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
793-
struct.pack('ii', 1, 0))
794-
s.connect(server.address)
795-
s.close()
786+
if self.family in (socket.AF_INET, getattr(socket, "AF_INET6", object())):
787+
server = BaseServer(self.family, self.addr)
788+
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1,
789+
count=500))
790+
t.start()
791+
792+
for x in range(20):
793+
s = socket.socket(self.family, socket.SOCK_STREAM)
794+
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
795+
struct.pack('ii', 1, 0))
796+
s.connect(server.address)
797+
s.close()
796798

797799

798800
class TestAPI_UseIPv4Sockets(BaseTestAPI):

0 commit comments

Comments
 (0)