fix failing test-suite with curl 7.83+

This commit is contained in:
Lukáš Zaoral 2022-05-03 16:44:03 +02:00
parent e2cc88ff0f
commit 9f7b356349
No known key found for this signature in database
GPG Key ID: 39157506DD67752D
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From d47c68b1364f8a1a45ab8c584c291d44b762f7b1 Mon Sep 17 00:00:00 2001
From: Samuel Henrique <samueloph@debian.org>
Date: Sat, 30 Apr 2022 23:02:34 +0100
Subject: [PATCH] tests: fix error message on error_test (for curl >= 7.83)
curl 7.83.0 removed exclamation marks from a few error messages, curl commit:
https://github.com/curl/curl/commit/6968fb9d54dc3a1aaa1b16088f038eaf5dd8b2d7
This commit adds support for the new curl release while also supporting the previous ones.
---
tests/error_test.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/error_test.py b/tests/error_test.py
index 01d0ac5ee..f32b693cb 100644
--- a/tests/error_test.py
+++ b/tests/error_test.py
@@ -29,7 +29,8 @@ def test_pycurl_error_libcurl(self):
err, msg = exc.args
self.assertEqual(pycurl.E_URL_MALFORMAT, err)
# possibly fragile
- self.assertEqual('No URL set!', msg)
+ # curl < 7.83.0 has an exclamation mark in this error message
+ self.assertIn(msg, ['No URL set!', 'No URL set'])
else:
self.fail('Expected pycurl.error to be raised')
@@ -43,9 +44,10 @@ def test_pycurl_errstr_type(self):
self.curl.perform()
except pycurl.error:
# might be fragile
- self.assertEqual('No URL set!', self.curl.errstr())
+ # curl < 7.83.0 has an exclamation mark in this error message
+ self.assertIn(self.curl.errstr(), ['No URL set!', 'No URL set'])
# repeated checks do not clear value
- self.assertEqual('No URL set!', self.curl.errstr())
+ self.assertIn(self.curl.errstr(), ['No URL set!', 'No URL set'])
# check the type - on all python versions
self.assertEqual(str, type(self.curl.errstr()))
else:

View File

@ -23,7 +23,7 @@
Name: python-%{modname}
Version: 7.45.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A Python interface to libcurl
License: LGPLv2+ or MIT
@ -32,6 +32,8 @@ Source0: https://files.pythonhosted.org/packages/47/f9/c41d6830f7bd4e70d5
# drop link-time vs. run-time TLS backend check (#1446850)
Patch1: 0001-python-pycurl-7.45.1-tls-backend.patch
# https://github.com/pycurl/pycurl/pull/753
Patch2: 0002-python-pycurl-7.45.1-curl-7.83-compatibility.patch
BuildRequires: gcc
BuildRequires: libcurl-devel
@ -161,6 +163,9 @@ rm -fvr tests/__pycache__
%endif
%changelog
* Tue May 03 2022 Lukáš Zaoral <lzaoral@redhat.com> - 7.45.1-2
- fix failing test-suite with curl 7.83+
* Tue Mar 15 2022 Lukáš Zaoral <lzaoral@redhat.com> - 7.45.1-1
- update to 7.45.1 (#2062500)
- do not ship tests/__pycache__