@@ -25,6 +25,13 @@ def wrapped(*args, **kwargs):
2525 return _retry_thrice (func , exc , * args , ** kwargs )
2626 return wrapped
2727
28+ # bpo-35411: FTP tests of test_urllib2net randomly fail
29+ # with "425 Security: Bad IP connecting" on Travis CI
30+ skip_ftp_test_on_travis = unittest .skipIf ('TRAVIS' in os .environ ,
31+ 'bpo-35411: skip FTP test '
32+ 'on Travis CI' )
33+
34+
2835# Connecting to remote hosts is flaky. Make it more robust by retrying
2936# the connection several times.
3037_urlopen_with_retry = _wrap_with_retry_thrice (urllib2 .urlopen , urllib2 .URLError )
@@ -100,6 +107,7 @@ def setUp(self):
100107 # XXX The rest of these tests aren't very good -- they don't check much.
101108 # They do sometimes catch some major disasters, though.
102109
110+ @skip_ftp_test_on_travis
103111 def test_ftp (self ):
104112 urls = [
105113 'ftp://www.pythontest.net/README' ,
@@ -285,12 +293,14 @@ def test_http_timeout(self):
285293
286294 FTP_HOST = 'ftp://www.pythontest.net/'
287295
296+ @skip_ftp_test_on_travis
288297 def test_ftp_basic (self ):
289298 self .assertIsNone (socket .getdefaulttimeout ())
290299 with test_support .transient_internet (self .FTP_HOST , timeout = None ):
291300 u = _urlopen_with_retry (self .FTP_HOST )
292301 self .assertIsNone (u .fp .fp ._sock .gettimeout ())
293302
303+ @skip_ftp_test_on_travis
294304 def test_ftp_default_timeout (self ):
295305 self .assertIsNone (socket .getdefaulttimeout ())
296306 with test_support .transient_internet (self .FTP_HOST ):
@@ -301,6 +311,7 @@ def test_ftp_default_timeout(self):
301311 socket .setdefaulttimeout (None )
302312 self .assertEqual (u .fp .fp ._sock .gettimeout (), 60 )
303313
314+ @skip_ftp_test_on_travis
304315 def test_ftp_no_timeout (self ):
305316 self .assertIsNone (socket .getdefaulttimeout (),)
306317 with test_support .transient_internet (self .FTP_HOST ):
@@ -311,6 +322,7 @@ def test_ftp_no_timeout(self):
311322 socket .setdefaulttimeout (None )
312323 self .assertIsNone (u .fp .fp ._sock .gettimeout ())
313324
325+ @skip_ftp_test_on_travis
314326 def test_ftp_timeout (self ):
315327 with test_support .transient_internet (self .FTP_HOST ):
316328 u = _urlopen_with_retry (self .FTP_HOST , timeout = 60 )
0 commit comments