]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35411: Skip test_urllib2net FTP tests on Travis CI (GH-10907)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Dec 2018 01:22:02 +0000 (17:22 -0800)
committerGitHub <noreply@github.com>
Wed, 5 Dec 2018 01:22:02 +0000 (17:22 -0800)
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@redhat.com>
Lib/test/pythoninfo.py
Lib/test/test_urllib2net.py

index 693a13525ff37b644ec9acdc7b56e92e71de32d2..ae1c07b43ac39a94131450e0ceb4d25b2d595c4c 100644 (file)
@@ -256,6 +256,7 @@ def collect_os(info_add):
         "TIX_LIBRARY",
         "TMP",
         "TMPDIR",
+        "TRAVIS",
         "TZ",
         "USERPROFILE",
         "VIRTUAL_ENV",
index 4ba79cbc31c3dc45ae08810eab8acc2383a97963..ee0b7fe453e671acf81091b4b56dd23be6ef52dc 100644 (file)
@@ -25,6 +25,13 @@ def _wrap_with_retry_thrice(func, exc):
         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(urllib2.urlopen, urllib2.URLError)
@@ -100,6 +107,7 @@ class OtherNetworkTests(unittest.TestCase):
     # 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',
@@ -285,12 +293,14 @@ class TimeoutTest(unittest.TestCase):
 
     FTP_HOST = 'ftp://www.pythontest.net/'
 
+    @skip_ftp_test_on_travis
     def test_ftp_basic(self):
         self.assertIsNone(socket.getdefaulttimeout())
         with test_support.transient_internet(self.FTP_HOST, timeout=None):
             u = _urlopen_with_retry(self.FTP_HOST)
             self.assertIsNone(u.fp.fp._sock.gettimeout())
 
+    @skip_ftp_test_on_travis
     def test_ftp_default_timeout(self):
         self.assertIsNone(socket.getdefaulttimeout())
         with test_support.transient_internet(self.FTP_HOST):
@@ -301,6 +311,7 @@ class TimeoutTest(unittest.TestCase):
                 socket.setdefaulttimeout(None)
             self.assertEqual(u.fp.fp._sock.gettimeout(), 60)
 
+    @skip_ftp_test_on_travis
     def test_ftp_no_timeout(self):
         self.assertIsNone(socket.getdefaulttimeout(),)
         with test_support.transient_internet(self.FTP_HOST):
@@ -311,6 +322,7 @@ class TimeoutTest(unittest.TestCase):
                 socket.setdefaulttimeout(None)
             self.assertIsNone(u.fp.fp._sock.gettimeout())
 
+    @skip_ftp_test_on_travis
     def test_ftp_timeout(self):
         with test_support.transient_internet(self.FTP_HOST):
             u = _urlopen_with_retry(self.FTP_HOST, timeout=60)