diff --git a/.gitignore b/.gitignore index 11d41cc..86cde6d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /httpretty-1.1.0.tar.gz /httpretty-1.1.2.tar.gz /httpretty-1.1.3.tar.gz +/httpretty-1.1.4.tar.gz diff --git a/435.patch b/435.patch deleted file mode 100644 index 85b4e35..0000000 --- a/435.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e2b6c2bd05d70898cc9d81ba74ceec7417e80e27 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Mon, 7 Jun 2021 18:50:26 +0200 -Subject: [PATCH] Fallback to WARNING when logging.getLogger().level is None - -We see the following errors in cloud-init that this solves: - - tests/unittests/test_data.py:66: in setUp - super(TestConsumeUserData, self).setUp() - cloudinit/tests/helpers.py:245: in setUp - super(FilesystemMockingTestCase, self).setUp() - cloudinit/tests/helpers.py:230: in setUp - super(ResourceUsingTestCase, self).setUp() - cloudinit/tests/helpers.py:362: in setUp - httpretty.enable() - /usr/lib/python3.9/site-packages/httpretty/core.py:1818: in enable - logger.setLevel(logging.getLogger().level) - /usr/lib64/python3.9/logging/__init__.py:1421: in setLevel - self.level = _checkLevel(level) - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - level = None - def _checkLevel(level): - if isinstance(level, int): - rv = level - elif str(level) == level: - if level not in _nameToLevel: - raise ValueError("Unknown level: %r" % level) - rv = _nameToLevel[level] - else: - > raise TypeError("Level not an integer or a valid string: %r" % level) - E TypeError: Level not an integer or a valid string: None - /usr/lib64/python3.9/logging/__init__.py:201: TypeError ---- - httpretty/core.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/httpretty/core.py b/httpretty/core.py -index c73700c..19715e0 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -1815,7 +1815,7 @@ def enable(cls, allow_net_connect=True, verbose=False): - if verbose: - logger.setLevel(logging.DEBUG) - else: -- logger.setLevel(logging.getLogger().level) -+ logger.setLevel(logging.getLogger().level or logging.WARNING) - - - def apply_patch_socket(): diff --git a/python-httpretty-fakesock_getpeercert_noconnect.patch b/python-httpretty-fakesock_getpeercert_noconnect.patch index 6fd10d3..d2e847d 100644 --- a/python-httpretty-fakesock_getpeercert_noconnect.patch +++ b/python-httpretty-fakesock_getpeercert_noconnect.patch @@ -1,7 +1,23 @@ -diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit/test_core.py ---- httpretty-1.0.2/tests/unit/test_core.py.orig 2020-03-20 01:54:16.000000000 +0100 -+++ httpretty-1.0.2/tests/unit/test_core.py 2020-03-27 11:14:13.000000000 +0100 -@@ -190,28 +190,35 @@ def test_fake_ssl_socket_proxies_its_ow_ +From d1e3fa6a2b96344636b0f891b36142526baa26df Mon Sep 17 00:00:00 2001 +From: Jiri Popelka +Date: Tue, 22 Jun 2021 18:09:21 +0200 +Subject: [PATCH 1/2] Apply patch + python-httpretty-fakesock_getpeercert_noconnect.patch + +patch_name: python-httpretty-fakesock_getpeercert_noconnect.patch +patch_id: 1 +description: |- + Avoid unnecessary remote access requirement (note: test only actually + does a remote connection after PR #313) +--- + tests/unit/test_core.py | 49 +++++++++++++++++++++++------------------ + 1 file changed, 28 insertions(+), 21 deletions(-) + +diff --git a/tests/unit/test_core.py b/tests/unit/test_core.py +index 80c4a86..dd59248 100644 +--- a/tests/unit/test_core.py ++++ b/tests/unit/test_core.py +@@ -191,28 +191,35 @@ def test_fake_ssl_socket_proxies_its_ow_socket(): @freeze_time("2013-10-04 04:20:00") def test_fakesock_socket_getpeercert(): ("fakesock.socket#getpeercert should return a hardcoded fake certificate") @@ -10,15 +26,10 @@ diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit - # And that it's bound to some host - socket._host = 'somewhere.com' -+ # Don't bother with an actual remote roundtrip -+ httpretty.allow_net_connect = False - +- - # When I retrieve the peer certificate - certificate = socket.getpeercert() -+ try: -+ # Given a fake socket instance -+ socket = fakesock.socket() - +- - # Then it should return a hardcoded value - certificate.should.equal({ - u'notAfter': 'Sep 29 04:20:00 GMT', @@ -32,6 +43,13 @@ diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit - (u'DNS', u'*') - ) - }) ++ # Don't bother with an actual remote roundtrip ++ httpretty.allow_net_connect = False ++ ++ try: ++ # Given a fake socket instance ++ socket = fakesock.socket() ++ + # And that it's bound to some host + socket._host = 'somewhere.com' + @@ -56,3 +74,6 @@ diff -up httpretty-1.0.2/tests/unit/test_core.py.orig httpretty-1.0.2/tests/unit def test_fakesock_socket_ssl(): +-- +2.31.1 + diff --git a/python-httpretty.spec b/python-httpretty.spec index d7d173a..d935014 100644 --- a/python-httpretty.spec +++ b/python-httpretty.spec @@ -14,9 +14,9 @@ %global run_tests 1 Name: python-httpretty -Version: 1.1.3 +Version: 1.1.4 # If github_date is defined, assume a post-release snapshot -Release: 4%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} +Release: 1%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} Summary: HTTP request mock tool for Python License: MIT @@ -27,15 +27,10 @@ Source0: %{pypi_source} # Avoid unnecessary remote access requirement (note: test only actually # does a remote connection after PR #313) -Patch1: python-httpretty-fakesock_getpeercert_noconnect.patch +Patch1: python-httpretty-fakesock_getpeercert_noconnect.patch # Remote access (these tests were skipped upstream in <= 0.9.7) -Patch2: skip-test_passthrough.patch - -# Fallback to WARNING when logging.getLogger().level is None -# This fixes FTBFS in cloud-init -# https://bugzilla.redhat.com/show_bug.cgi?id=1961555 -Patch3: https://github.com/gabrielfalcao/HTTPretty/pull/435.patch +Patch2: skip-test_passthrough.patch BuildArch: noarch @@ -166,6 +161,9 @@ LANG=C.UTF-8 %{__python2} -m nose -v %changelog +* Thu Aug 19 2021 Jiri Popelka - 1.1.4-1 +- 1.1.4 + * Fri Jul 23 2021 Fedora Release Engineering - 1.1.3-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/skip-test_passthrough.patch b/skip-test_passthrough.patch index 7e48a87..35ed783 100644 --- a/skip-test_passthrough.patch +++ b/skip-test_passthrough.patch @@ -1,6 +1,20 @@ -diff -up httpretty-1.1.2/tests/functional/test_passthrough.py.orig httpretty-1.1.2/tests/functional/test_passthrough.py ---- httpretty-1.1.2/tests/functional/test_passthrough.py.orig 2021-05-14 03:02:06.000000000 +0200 -+++ httpretty-1.1.2/tests/functional/test_passthrough.py 2021-05-24 09:48:01.790645558 +0200 +From 683a5216502be770ad21a7dc616acdec70d77f68 Mon Sep 17 00:00:00 2001 +From: Jiri Popelka +Date: Tue, 22 Jun 2021 18:09:22 +0200 +Subject: [PATCH 2/2] Apply patch skip-test_passthrough.patch + +patch_name: skip-test_passthrough.patch +patch_id: 2 +description: |- + Remote access (these tests were skipped upstream in <= 0.9.7) +--- + tests/functional/test_passthrough.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tests/functional/test_passthrough.py b/tests/functional/test_passthrough.py +index 47c9e79..7a77d23 100644 +--- a/tests/functional/test_passthrough.py ++++ b/tests/functional/test_passthrough.py @@ -24,6 +24,7 @@ import requests import httpretty @@ -25,3 +39,6 @@ diff -up httpretty-1.1.2/tests/functional/test_passthrough.py.orig httpretty-1.1 def test_https_passthrough(): url = 'https://httpbin.org/status/200' +-- +2.31.1 + diff --git a/sources b/sources index de5d244..21ff8e9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (httpretty-1.1.3.tar.gz) = 3bac68ecb78efc7592f9ab314ca9ef570c8193fb7c2ab3d3fa003b0ff623ac57d6a74f8f0e7b6c2ed45f30e520d157345db56837212d9acd4ec6259570a43dfe +SHA512 (httpretty-1.1.4.tar.gz) = 4daceea4f30ce181e871167d304bd7af9d504364f55d42f8025770f2efe7e833d018aed681c8733d653d4de90db3433e999c56bccd4675f81e66d1cc4023e418