mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-35411: Skip test_urllib2net FTP tests on Travis CI (GH-10907)
On Travis CI, FTP tests of test_urllib2net randomly fail with "425 Security: Bad IP connecting". test.pythoninfo now also logs TRAVIS environment variable.
This commit is contained in:
parent
09473ac063
commit
c11b3b19a5
2 changed files with 13 additions and 0 deletions
|
@ -256,6 +256,7 @@ def collect_os(info_add):
|
||||||
"TIX_LIBRARY",
|
"TIX_LIBRARY",
|
||||||
"TMP",
|
"TMP",
|
||||||
"TMPDIR",
|
"TMPDIR",
|
||||||
|
"TRAVIS",
|
||||||
"TZ",
|
"TZ",
|
||||||
"USERPROFILE",
|
"USERPROFILE",
|
||||||
"VIRTUAL_ENV",
|
"VIRTUAL_ENV",
|
||||||
|
|
|
@ -27,6 +27,13 @@ def _wrap_with_retry_thrice(func, exc):
|
||||||
return _retry_thrice(func, exc, *args, **kwargs)
|
return _retry_thrice(func, exc, *args, **kwargs)
|
||||||
return wrapped
|
return wrapped
|
||||||
|
|
||||||
|
# bpo-35411: FTP tests of test_urllib2net randomly fail
|
||||||
|
# with "425 Security: Bad IP connecting" on Travis CI
|
||||||
|
skip_ftp_test_on_travis = unittest.skipIf('TRAVIS' in os.environ,
|
||||||
|
'bpo-35411: skip FTP test '
|
||||||
|
'on Travis CI')
|
||||||
|
|
||||||
|
|
||||||
# Connecting to remote hosts is flaky. Make it more robust by retrying
|
# Connecting to remote hosts is flaky. Make it more robust by retrying
|
||||||
# the connection several times.
|
# the connection several times.
|
||||||
_urlopen_with_retry = _wrap_with_retry_thrice(urllib.request.urlopen,
|
_urlopen_with_retry = _wrap_with_retry_thrice(urllib.request.urlopen,
|
||||||
|
@ -95,6 +102,7 @@ class OtherNetworkTests(unittest.TestCase):
|
||||||
# XXX The rest of these tests aren't very good -- they don't check much.
|
# XXX The rest of these tests aren't very good -- they don't check much.
|
||||||
# They do sometimes catch some major disasters, though.
|
# They do sometimes catch some major disasters, though.
|
||||||
|
|
||||||
|
@skip_ftp_test_on_travis
|
||||||
def test_ftp(self):
|
def test_ftp(self):
|
||||||
urls = [
|
urls = [
|
||||||
'ftp://www.pythontest.net/README',
|
'ftp://www.pythontest.net/README',
|
||||||
|
@ -290,6 +298,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
|
|
||||||
FTP_HOST = 'ftp://www.pythontest.net/'
|
FTP_HOST = 'ftp://www.pythontest.net/'
|
||||||
|
|
||||||
|
@skip_ftp_test_on_travis
|
||||||
def test_ftp_basic(self):
|
def test_ftp_basic(self):
|
||||||
self.assertIsNone(socket.getdefaulttimeout())
|
self.assertIsNone(socket.getdefaulttimeout())
|
||||||
with support.transient_internet(self.FTP_HOST, timeout=None):
|
with support.transient_internet(self.FTP_HOST, timeout=None):
|
||||||
|
@ -297,6 +306,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
self.addCleanup(u.close)
|
self.addCleanup(u.close)
|
||||||
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
|
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
|
||||||
|
|
||||||
|
@skip_ftp_test_on_travis
|
||||||
def test_ftp_default_timeout(self):
|
def test_ftp_default_timeout(self):
|
||||||
self.assertIsNone(socket.getdefaulttimeout())
|
self.assertIsNone(socket.getdefaulttimeout())
|
||||||
with support.transient_internet(self.FTP_HOST):
|
with support.transient_internet(self.FTP_HOST):
|
||||||
|
@ -308,6 +318,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
socket.setdefaulttimeout(None)
|
socket.setdefaulttimeout(None)
|
||||||
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
|
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
|
||||||
|
|
||||||
|
@skip_ftp_test_on_travis
|
||||||
def test_ftp_no_timeout(self):
|
def test_ftp_no_timeout(self):
|
||||||
self.assertIsNone(socket.getdefaulttimeout())
|
self.assertIsNone(socket.getdefaulttimeout())
|
||||||
with support.transient_internet(self.FTP_HOST):
|
with support.transient_internet(self.FTP_HOST):
|
||||||
|
@ -319,6 +330,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
socket.setdefaulttimeout(None)
|
socket.setdefaulttimeout(None)
|
||||||
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
|
self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
|
||||||
|
|
||||||
|
@skip_ftp_test_on_travis
|
||||||
def test_ftp_timeout(self):
|
def test_ftp_timeout(self):
|
||||||
with support.transient_internet(self.FTP_HOST):
|
with support.transient_internet(self.FTP_HOST):
|
||||||
u = _urlopen_with_retry(self.FTP_HOST, timeout=60)
|
u = _urlopen_with_retry(self.FTP_HOST, timeout=60)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue