@@ -27,6 +27,13 @@ def wrapped(*args, **kwargs):
27
27
return _retry_thrice (func , exc , * args , ** kwargs )
28
28
return wrapped
29
29
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
+
30
37
# Connecting to remote hosts is flaky. Make it more robust by retrying
31
38
# the connection several times.
32
39
_urlopen_with_retry = _wrap_with_retry_thrice (urllib .request .urlopen ,
@@ -95,6 +102,7 @@ def setUp(self):
95
102
# XXX The rest of these tests aren't very good -- they don't check much.
96
103
# They do sometimes catch some major disasters, though.
97
104
105
+ @skip_ftp_test_on_travis
98
106
def test_ftp (self ):
99
107
urls = [
100
108
'ftp://www.pythontest.net/README' ,
@@ -289,13 +297,15 @@ def test_http_timeout(self):
289
297
290
298
FTP_HOST = 'ftp://www.pythontest.net/'
291
299
300
+ @skip_ftp_test_on_travis
292
301
def test_ftp_basic (self ):
293
302
self .assertIsNone (socket .getdefaulttimeout ())
294
303
with support .transient_internet (self .FTP_HOST , timeout = None ):
295
304
u = _urlopen_with_retry (self .FTP_HOST )
296
305
self .addCleanup (u .close )
297
306
self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
298
307
308
+ @skip_ftp_test_on_travis
299
309
def test_ftp_default_timeout (self ):
300
310
self .assertIsNone (socket .getdefaulttimeout ())
301
311
with support .transient_internet (self .FTP_HOST ):
@@ -307,6 +317,7 @@ def test_ftp_default_timeout(self):
307
317
socket .setdefaulttimeout (None )
308
318
self .assertEqual (u .fp .fp .raw ._sock .gettimeout (), 60 )
309
319
320
+ @skip_ftp_test_on_travis
310
321
def test_ftp_no_timeout (self ):
311
322
self .assertIsNone (socket .getdefaulttimeout ())
312
323
with support .transient_internet (self .FTP_HOST ):
@@ -318,6 +329,7 @@ def test_ftp_no_timeout(self):
318
329
socket .setdefaulttimeout (None )
319
330
self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
320
331
332
+ @skip_ftp_test_on_travis
321
333
def test_ftp_timeout (self ):
322
334
with support .transient_internet (self .FTP_HOST ):
323
335
u = _urlopen_with_retry (self .FTP_HOST , timeout = 60 )
0 commit comments