From: Ben Darnell Date: Sat, 24 May 2014 21:47:14 +0000 (-0400) Subject: Skip dual-stack ipv4/ipv6 tests on travis. X-Git-Tag: v4.0.0b1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2aed36fa65a514778066f409a3ad25e54565470b;p=thirdparty%2Ftornado.git 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. --- 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