]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Skip dual-stack ipv4/ipv6 tests on travis.
authorBen Darnell <ben@bendarnell.com>
Sat, 24 May 2014 21:47:14 +0000 (17:47 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 24 May 2014 21:47:14 +0000 (17:47 -0400)
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
tornado/test/tcpclient_test.py

index 9f7c85cb5ef8fbc1ea2455f987a2ca2a3e062209..94e5e4d25754bd42a9fabe696d8b03c5f5250842 100644 (file)
@@ -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]
index a766907298043b5f6975edf33442c4439f67cf39..ae0e6a06c19bab031a53d33830d5754b8bd5b551 100644 (file)
@@ -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