[Python-checkins] bpo-35411: Skip test_urllib2net FTP tests on Travis CI (GH-10907)

Miss Islington (bot) webhook-mailer at python.org
Tue Dec 4 20:16:44 EST 2018


https://github.com/python/cpython/commit/74a80e1ed0c9067ef47f0a637d7f718a51b4f34e
commit: 74a80e1ed0c9067ef47f0a637d7f718a51b4f34e
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-12-04T17:16:39-08:00
summary:

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.
(cherry picked from commit c11b3b19a5b022c6c229043d37f9a9fd06f22500)

Co-authored-by: Victor Stinner <vstinner at redhat.com>

files:
M Lib/test/pythoninfo.py
M Lib/test/test_urllib2net.py

diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index 30e6f21c2b48..9befd12e4095 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -256,6 +256,7 @@ def format_groups(groups):
         "TIX_LIBRARY",
         "TMP",
         "TMPDIR",
+        "TRAVIS",
         "TZ",
         "USERPROFILE",
         "VIRTUAL_ENV",
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index 15f73de9f029..1aa64cbee1ca 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -27,6 +27,13 @@ def wrapped(*args, **kwargs):
         return _retry_thrice(func, exc, *args, **kwargs)
     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
 # the connection several times.
 _urlopen_with_retry = _wrap_with_retry_thrice(urllib.request.urlopen,
@@ -95,6 +102,7 @@ def setUp(self):
     # XXX The rest of these tests aren't very good -- they don't check much.
     # They do sometimes catch some major disasters, though.
 
+    @skip_ftp_test_on_travis
     def test_ftp(self):
         urls = [
             'ftp://www.pythontest.net/README',
@@ -290,6 +298,7 @@ def test_http_timeout(self):
 
     FTP_HOST = 'ftp://www.pythontest.net/'
 
+    @skip_ftp_test_on_travis
     def test_ftp_basic(self):
         self.assertIsNone(socket.getdefaulttimeout())
         with support.transient_internet(self.FTP_HOST, timeout=None):
@@ -297,6 +306,7 @@ def test_ftp_basic(self):
             self.addCleanup(u.close)
             self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
 
+    @skip_ftp_test_on_travis
     def test_ftp_default_timeout(self):
         self.assertIsNone(socket.getdefaulttimeout())
         with support.transient_internet(self.FTP_HOST):
@@ -308,6 +318,7 @@ def test_ftp_default_timeout(self):
                 socket.setdefaulttimeout(None)
             self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
 
+    @skip_ftp_test_on_travis
     def test_ftp_no_timeout(self):
         self.assertIsNone(socket.getdefaulttimeout())
         with support.transient_internet(self.FTP_HOST):
@@ -319,6 +330,7 @@ def test_ftp_no_timeout(self):
                 socket.setdefaulttimeout(None)
             self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
 
+    @skip_ftp_test_on_travis
     def test_ftp_timeout(self):
         with support.transient_internet(self.FTP_HOST):
             u = _urlopen_with_retry(self.FTP_HOST, timeout=60)



More information about the Python-checkins mailing list