python-pycurl/backport-option_constants_test-skip-check-of-SSLVERSION_SSLv*.patch

65 lines
2.1 KiB
Diff

From 18f1103fb9c6b4dc2233e323e3df1818db25c209 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 27 May 2021 10:52:09 +0200
Subject: [PATCH] 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
---
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 20228c66f..8b3bd9c69 100644
--- a/tests/option_constants_test.py
+++ b/tests/option_constants_test.py
@@ -164,9 +164,16 @@ def test_gssapi_delegation_options(self):
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 e12e25152..37ad2f9ab 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -122,6 +122,21 @@ def decorated(*args, **kwargs):
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