Skip to content

Commit 8bcbc78

Browse files
vstinnerlarryhastings
authored andcommitted
bpo-35411: Skip test_urllib2net FTP tests on Travis CI (GH-10907) (#11874)
On Travis CI, FTP tests of test_urllib2net randomly fail with "425 Security: Bad IP connecting". (cherry picked from commit c11b3b1)
1 parent 41b48e7 commit 8bcbc78

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_urllib2net.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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',
@@ -289,13 +297,15 @@ def test_http_timeout(self):
289297

290298
FTP_HOST = 'ftp://www.pythontest.net/'
291299

300+
@skip_ftp_test_on_travis
292301
def test_ftp_basic(self):
293302
self.assertIsNone(socket.getdefaulttimeout())
294303
with support.transient_internet(self.FTP_HOST, timeout=None):
295304
u = _urlopen_with_retry(self.FTP_HOST)
296305
self.addCleanup(u.close)
297306
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
298307

308+
@skip_ftp_test_on_travis
299309
def test_ftp_default_timeout(self):
300310
self.assertIsNone(socket.getdefaulttimeout())
301311
with support.transient_internet(self.FTP_HOST):
@@ -307,6 +317,7 @@ def test_ftp_default_timeout(self):
307317
socket.setdefaulttimeout(None)
308318
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
309319

320+
@skip_ftp_test_on_travis
310321
def test_ftp_no_timeout(self):
311322
self.assertIsNone(socket.getdefaulttimeout())
312323
with support.transient_internet(self.FTP_HOST):
@@ -318,6 +329,7 @@ def test_ftp_no_timeout(self):
318329
socket.setdefaulttimeout(None)
319330
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
320331

332+
@skip_ftp_test_on_travis
321333
def test_ftp_timeout(self):
322334
with support.transient_internet(self.FTP_HOST):
323335
u = _urlopen_with_retry(self.FTP_HOST, timeout=60)

0 commit comments

Comments
 (0)