@@ -27,6 +27,13 @@ def wrapped(*args, **kwargs):
2727 return _retry_thrice (func , exc , * args , ** kwargs )
2828 return wrapped
2929
30+ # bpo-35411: FTP tests of test_urllib2net randomly fail
31+ # with "425 Security: Bad IP connecting" on Travis CI
32+ skip_ftp_test_on_travis = unittest .skipIf ('TRAVIS' in os .environ ,
33+ 'bpo-35411: skip FTP test '
34+ 'on Travis CI' )
35+
36+
3037# Connecting to remote hosts is flaky. Make it more robust by retrying
3138# the connection several times.
3239_urlopen_with_retry = _wrap_with_retry_thrice (urllib .request .urlopen ,
@@ -95,6 +102,7 @@ def setUp(self):
95102 # XXX The rest of these tests aren't very good -- they don't check much.
96103 # They do sometimes catch some major disasters, though.
97104
105+ @skip_ftp_test_on_travis
98106 def test_ftp (self ):
99107 urls = [
100108 'ftp://www.pythontest.net/README' ,
@@ -290,13 +298,15 @@ def test_http_timeout(self):
290298
291299 FTP_HOST = 'ftp://www.pythontest.net/'
292300
301+ @skip_ftp_test_on_travis
293302 def test_ftp_basic (self ):
294303 self .assertIsNone (socket .getdefaulttimeout ())
295304 with support .transient_internet (self .FTP_HOST , timeout = None ):
296305 u = _urlopen_with_retry (self .FTP_HOST )
297306 self .addCleanup (u .close )
298307 self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
299308
309+ @skip_ftp_test_on_travis
300310 def test_ftp_default_timeout (self ):
301311 self .assertIsNone (socket .getdefaulttimeout ())
302312 with support .transient_internet (self .FTP_HOST ):
@@ -308,6 +318,7 @@ def test_ftp_default_timeout(self):
308318 socket .setdefaulttimeout (None )
309319 self .assertEqual (u .fp .fp .raw ._sock .gettimeout (), 60 )
310320
321+ @skip_ftp_test_on_travis
311322 def test_ftp_no_timeout (self ):
312323 self .assertIsNone (socket .getdefaulttimeout ())
313324 with support .transient_internet (self .FTP_HOST ):
@@ -319,6 +330,7 @@ def test_ftp_no_timeout(self):
319330 socket .setdefaulttimeout (None )
320331 self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
321332
333+ @skip_ftp_test_on_travis
322334 def test_ftp_timeout (self ):
323335 with support .transient_internet (self .FTP_HOST ):
324336 u = _urlopen_with_retry (self .FTP_HOST , timeout = 60 )
0 commit comments