From 2aed36fa65a514778066f409a3ad25e54565470b Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 24 May 2014 17:47:14 -0400 Subject: [PATCH] Skip dual-stack ipv4/ipv6 tests on travis. These tests occasionally fail (they bind to an unused ipv6 port but cannot bind that same port on ipv4), and I'm not sure how to fix/workaround. --- tornado/test/netutil_test.py | 3 +++ tornado/test/tcpclient_test.py | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tornado/test/netutil_test.py b/tornado/test/netutil_test.py index 9f7c85cb5..94e5e4d25 100644 --- a/tornado/test/netutil_test.py +++ b/tornado/test/netutil_test.py @@ -1,5 +1,6 @@ from __future__ import absolute_import, division, print_function, with_statement +import os import signal import socket from subprocess import Popen @@ -155,6 +156,8 @@ class IsValidIPTest(unittest.TestCase): class TestPortAllocation(unittest.TestCase): def test_same_port_allocation(self): + if 'TRAVIS' in os.environ: + self.skipTest("dual-stack servers often have port conflicts on travis") sockets = bind_sockets(None, 'localhost') try: port = sockets[0].getsockname()[1] diff --git a/tornado/test/tcpclient_test.py b/tornado/test/tcpclient_test.py index a76690729..ae0e6a06c 100644 --- a/tornado/test/tcpclient_test.py +++ b/tornado/test/tcpclient_test.py @@ -17,6 +17,7 @@ from __future__ import absolute_import, division, print_function, with_statement from contextlib import closing +import os import socket from tornado.concurrent import Future @@ -34,11 +35,7 @@ class TestTCPServer(TCPServer): def __init__(self, family): super(TestTCPServer, self).__init__() self.streams = [] - try: - sockets = bind_sockets(None, 'localhost', family) - except: - print(socket.getaddrinfo('localhost', 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)) - raise + sockets = bind_sockets(None, 'localhost', family) self.add_sockets(sockets) self.port = sockets[0].getsockname()[1] @@ -57,6 +54,8 @@ class TCPClientTest(AsyncTestCase): self.client = TCPClient() def start_server(self, family): + if family == socket.AF_UNSPEC and 'TRAVIS' in os.environ: + self.skipTest("dual-stack servers often have port conflicts on travis") self.server = TestTCPServer(family) return self.server.port -- 2.47.2