summaryrefslogtreecommitdiff
path: root/dev-python/pycurl/files/7.44-fix-tests.patch
blob: d5d900100086f786c442c420f55967642046e219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
https://github.com/pycurl/pycurl/commit/d47c68b1364f8a1a45ab8c584c291d44b762f7b1
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.
--- 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: