@@ -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' ,
@@ -290,13 +298,15 @@ def test_http_timeout(self):
290
298
291
299
FTP_HOST = 'ftp://www.pythontest.net/'
292
300
301
+ @skip_ftp_test_on_travis
293
302
def test_ftp_basic (self ):
294
303
self .assertIsNone (socket .getdefaulttimeout ())
295
304
with support .transient_internet (self .FTP_HOST , timeout = None ):
296
305
u = _urlopen_with_retry (self .FTP_HOST )
297
306
self .addCleanup (u .close )
298
307
self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
299
308
309
+ @skip_ftp_test_on_travis
300
310
def test_ftp_default_timeout (self ):
301
311
self .assertIsNone (socket .getdefaulttimeout ())
302
312
with support .transient_internet (self .FTP_HOST ):
@@ -308,6 +318,7 @@ def test_ftp_default_timeout(self):
308
318
socket .setdefaulttimeout (None )
309
319
self .assertEqual (u .fp .fp .raw ._sock .gettimeout (), 60 )
310
320
321
+ @skip_ftp_test_on_travis
311
322
def test_ftp_no_timeout (self ):
312
323
self .assertIsNone (socket .getdefaulttimeout ())
313
324
with support .transient_internet (self .FTP_HOST ):
@@ -319,6 +330,7 @@ def test_ftp_no_timeout(self):
319
330
socket .setdefaulttimeout (None )
320
331
self .assertIsNone (u .fp .fp .raw ._sock .gettimeout ())
321
332
333
+ @skip_ftp_test_on_travis
322
334
def test_ftp_timeout (self ):
323
335
with support .transient_internet (self .FTP_HOST ):
324
336
u = _urlopen_with_retry (self .FTP_HOST , timeout = 60 )
0 commit comments