diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2012-03-23 12:29:01 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2012-03-23 12:29:01 (GMT) |
commit | 466a54f4dcf7e16acdc037320feecc20aea10a9b (patch) | |
tree | 24a2cc77242ca6a7aa23fcdd7ea57e491a7300f0 /Lib/test/test_asyncore.py | |
parent | 42243c4dcaee5fe6e680d1ea4b1b615dd0d18b10 (diff) | |
download | cpython-466a54f4dcf7e16acdc037320feecc20aea10a9b.zip cpython-466a54f4dcf7e16acdc037320feecc20aea10a9b.tar.gz cpython-466a54f4dcf7e16acdc037320feecc20aea10a9b.tar.bz2 |
fix failing asyncore test as per http://bugs.python.org/issue10340#msg156586
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r-- | Lib/test/test_asyncore.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index c1df785..0bd09fd 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -783,16 +783,18 @@ class BaseTestAPI(unittest.TestCase): @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() - - 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() + 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(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): |