skip tests which are incompatible with recent releases of libcurl

This commit is contained in:
Kamil Dudka 2021-06-03 09:57:24 +02:00
parent e86e600864
commit e53af03fe6
2 changed files with 130 additions and 5 deletions

View File

@ -0,0 +1,123 @@
From bffb28426a6fd2ebdec6223b271fc1d636d6ee8f Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 27 May 2021 10:52:09 +0200
Subject: [PATCH 1/2] option_constants_test: skip check of SSLVERSION_SSLv*
... with curl-7.77.0, where they started to return
CURLE_BAD_FUNCTION_ARGUMENT:
https://github.com/curl/curl/pull/6773
Closes: https://github.com/pycurl/pycurl/pull/689
Upstream-commit: 18f1103fb9c6b4dc2233e323e3df1818db25c209
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/option_constants_test.py | 9 ++++++++-
tests/util.py | 15 +++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/tests/option_constants_test.py b/tests/option_constants_test.py
index bd0d62d..2f66e7b 100644
--- a/tests/option_constants_test.py
+++ b/tests/option_constants_test.py
@@ -164,9 +164,16 @@ class OptionConstantsTest(unittest.TestCase):
def test_sslversion_options(self):
curl = pycurl.Curl()
curl.setopt(curl.SSLVERSION, curl.SSLVERSION_DEFAULT)
+ curl.setopt(curl.SSLVERSION, curl.SSLVERSION_TLSv1)
+ curl.close()
+
+ # SSLVERSION_SSLv* return CURLE_BAD_FUNCTION_ARGUMENT with curl-7.77.0
+ @util.removed_in_libcurl(7, 77, 0)
+ @util.only_ssl
+ def test_legacy_sslversion_options(self):
+ curl = pycurl.Curl()
curl.setopt(curl.SSLVERSION, curl.SSLVERSION_SSLv2)
curl.setopt(curl.SSLVERSION, curl.SSLVERSION_SSLv3)
- curl.setopt(curl.SSLVERSION, curl.SSLVERSION_TLSv1)
curl.close()
@util.min_libcurl(7, 34, 0)
diff --git a/tests/util.py b/tests/util.py
index e12e251..37ad2f9 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -122,6 +122,21 @@ def min_libcurl(major, minor, patch):
return decorator
+def removed_in_libcurl(major, minor, patch):
+ import nose.plugins.skip
+
+ def decorator(fn):
+ @functools.wraps(fn)
+ def decorated(*args, **kwargs):
+ if not pycurl_version_less_than(major, minor, patch):
+ raise nose.plugins.skip.SkipTest('libcurl >= %d.%d.%d' % (major, minor, patch))
+
+ return fn(*args, **kwargs)
+
+ return decorated
+
+ return decorator
+
def only_ssl(fn):
import nose.plugins.skip
import pycurl
--
2.31.1
From 3d0cec1e21e4edd204204e2498828b1241c08bfe Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 1 Jun 2021 16:56:40 +0200
Subject: [PATCH 2/2] failonerror_test: skip the test with curl-7.75.0+
libcurl does not provide the reason phrase from HTTP status line
in the error buffer any more:
https://github.com/curl/curl/issues/6615
Fixes: https://github.com/pycurl/pycurl/issues/679
Upstream-commit: a03c4a4ea3fb42b347bada24faae1d31c7d0c90e
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
tests/failonerror_test.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/failonerror_test.py b/tests/failonerror_test.py
index 607c21d..777f575 100644
--- a/tests/failonerror_test.py
+++ b/tests/failonerror_test.py
@@ -21,6 +21,8 @@ class FailonerrorTest(unittest.TestCase):
# not sure what the actual min is but 7.26 is too old
# and does not include status text, only the status code
@util.min_libcurl(7, 38, 0)
+ # no longer supported by libcurl: https://github.com/curl/curl/issues/6615
+ @util.removed_in_libcurl(7, 75, 0)
def test_failonerror(self):
self.curl.setopt(pycurl.URL, 'http://%s:8380/status/403' % localhost)
sio = util.BytesIO()
@@ -41,6 +43,8 @@ class FailonerrorTest(unittest.TestCase):
# not sure what the actual min is but 7.26 is too old
# and does not include status text, only the status code
@util.min_libcurl(7, 38, 0)
+ # no longer supported by libcurl: https://github.com/curl/curl/issues/6615
+ @util.removed_in_libcurl(7, 75, 0)
def test_failonerror_status_line_invalid_utf8_python2(self):
self.curl.setopt(pycurl.URL, 'http://%s:8380/status_invalid_utf8' % localhost)
sio = util.BytesIO()
@@ -61,6 +65,8 @@ class FailonerrorTest(unittest.TestCase):
# not sure what the actual min is but 7.26 is too old
# and does not include status text, only the status code
@util.min_libcurl(7, 38, 0)
+ # no longer supported by libcurl: https://github.com/curl/curl/issues/6615
+ @util.removed_in_libcurl(7, 75, 0)
def test_failonerror_status_line_invalid_utf8_python3(self):
self.curl.setopt(pycurl.URL, 'http://%s:8380/status_invalid_utf8' % localhost)
sio = util.BytesIO()
--
2.31.1

View File

@ -23,7 +23,7 @@
Name: python-%{modname}
Version: 7.43.0.6
Release: 6%{?dist}
Release: 7%{?dist}
Summary: A Python interface to libcurl
License: LGPLv2+ or MIT
@ -38,6 +38,9 @@ Patch1: 0001-python-pycurl-7.43.0.6-python-3.10.patch
# drop link-time vs. run-time TLS backend check (#1446850)
Patch2: 0002-python-pycurl-7.43.0-tls-backend.patch
# skip tests which are incompatible with recent releases of libcurl
Patch3: 0003-python-pycurl-7.43.0.6-tests.patch
BuildRequires: gcc
BuildRequires: libcurl-devel
BuildRequires: openssl-devel
@ -111,10 +114,6 @@ sed -e 's| winbuild.py||' -i Makefile
# remove binaries packaged by upstream
rm -f tests/fake-curl/libcurl/*.so
# temporarily remove a failing test-case (#1927655)
# upstream issue: https://github.com/curl/curl/issues/6615
rm -f tests/failonerror_test.py
# remove a test-case that relies on sftp://web.sourceforge.net being available
rm -f tests/ssh_key_cb_test.py
@ -186,6 +185,9 @@ rm -fv tests/fake-curl/libcurl/*.so
%endif
%changelog
* Thu Jun 03 2021 Kamil Dudka <kdudka@redhat.com> - 7.43.0.6-7
- skip tests which are incompatible with recent releases of libcurl
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 7.43.0.6-6
- Rebuilt for Python 3.10