diff --git a/.gitignore b/.gitignore index f7d5676..58a9a28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /httpretty-0.8.3.tar.gz /HTTPretty-70af1f8.tar.gz /httpretty-0.9.5.tar.gz +/httpretty-0.9.6.tar.gz diff --git a/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch b/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch deleted file mode 100644 index 06a389f..0000000 --- a/0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 01474bf64e0434881059a3638abff5bb62eaedb1 Mon Sep 17 00:00:00 2001 -From: Scott Moser -Date: Tue, 24 Jan 2017 12:30:47 -0500 -Subject: [PATCH] Call reset from setUp and tearDown in addition to enable and - disable. - -When decorating a class via setUp and tearDown, reset() was not being -called. That was an unintentional change in behavior from previous versions. - -Addresses #316. ---- - httpretty/core.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/httpretty/core.py b/httpretty/core.py -index 4f72678..25df1fd 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -1580,6 +1580,7 @@ def httprettified(test): - else None) - - def new_setUp(self): -+ httpretty.reset() - httpretty.enable() - if use_addCleanup: - self.addCleanup(httpretty.disable) -@@ -1594,6 +1595,7 @@ def httprettified(test): - - def new_tearDown(self): - httpretty.disable() -+ httpretty.reset() - if original_tearDown: - original_tearDown(self) - klass.tearDown = new_tearDown --- -2.9.3 - diff --git a/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch b/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch deleted file mode 100644 index eb4ca43..0000000 --- a/0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 5d2f8d99c28519fe0cf47ebf5f043928d422b757 Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Fri, 6 Jan 2017 17:56:43 -0800 -Subject: [PATCH] Handle bugs in older urllib3 versions in one of the tests - -Older urllib3 versions had a bug where they lower-cased header -names (in response header dicts). That makes one of our tests -fail with older urllib3, because the test expects a 'Server' -header. As this isn't our fault at all, just have the test cope -with it by checking if the header dict has a 'server' key and -replacing it with a 'Server' key with the same value. - -urllib3 1.10 also had a bug when you called dict() on its -HTTPHeaderDict class; it would turn this: - -{'headername': 'value'} - -Into this: - -{'headername': ['headername', 'value']} - -That was fixed in 1.11, but RHEL 6 still has 1.10, so let's -work with that by doing dict(headerdict.items()) instead of -just dict(headerdict) (when we're recording the calls). ---- - httpretty/core.py | 7 ++++++- - tests/functional/test_requests.py | 5 +++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - -diff --git a/httpretty/core.py b/httpretty/core.py -index 34d1ed1..0c2d334 100644 ---- a/httpretty/core.py -+++ b/httpretty/core.py -@@ -971,7 +971,12 @@ class httpretty(HttpBaseClass): - 'response': { - 'status': response.status, - 'body': decode_utf8(response.data), -- 'headers': dict(response.headers) -+ # urllib3 1.10 had a bug if you just did: -+ # dict(response.headers) -+ # which would cause all the values to become lists -+ # with the header name as the first item and the -+ # true value as the second item. Workaround that -+ 'headers': dict(response.headers.items()) - } - }) - cls.enable() -diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py -index 4e2063e..18c89f8 100644 ---- a/tests/functional/test_requests.py -+++ b/tests/functional/test_requests.py -@@ -742,6 +742,11 @@ def test_recording_calls(port): - response['response'].should.have.key("status").being.equal(200) - response['response'].should.have.key("body").being.an(text_type) - response['response'].should.have.key("headers").being.a(dict) -+ # older urllib3 had a bug where header keys were lower-cased: -+ # https://github.com/shazow/urllib3/issues/236 -+ # cope with that -+ if 'server' in response['response']["headers"]: -+ response['response']["headers"]["Server"] = response['response']["headers"].pop("server") - response['response']["headers"].should.have.key("Server").being.equal("TornadoServer/" + tornado_version) - - # And When I playback the previously recorded calls --- -2.11.0 - diff --git a/python-httpretty-fakesock_getpeercert_noconnect.patch b/python-httpretty-fakesock_getpeercert_noconnect.patch index 16bdcd7..6956641 100644 --- a/python-httpretty-fakesock_getpeercert_noconnect.patch +++ b/python-httpretty-fakesock_getpeercert_noconnect.patch @@ -12,8 +12,8 @@ - # Given a fake socket instance - socket = fakesock.socket() - -- # And that it's bound to some host and port -- socket.connect(('somewhere.com', 80)) +- # And that it's bound to some host +- socket._host = 'somewhere.com' - - # When I retrieve the peer certificate - certificate = socket.getpeercert() @@ -38,8 +38,8 @@ + # Given a fake socket instance + socket = fakesock.socket() + -+ # And that it's bound to some host and port -+ socket.connect(('somewhere.com', 80)) ++ # And that it's bound to some host ++ socket._host = 'somewhere.com' + + # When I retrieve the peer certificate + certificate = socket.getpeercert() diff --git a/python-httpretty.spec b/python-httpretty.spec index 72d5047..6ba9043 100644 --- a/python-httpretty.spec +++ b/python-httpretty.spec @@ -1,11 +1,11 @@ -%if 0%{?fedora} || 0%{?rhel} > 7 -# escaping for EPEL. -%global with_python3 1 +%if %{defined rhel} || (%{defined fedora} && 0%{?fedora} < 30) +%bcond_without python2 %endif +%bcond_without python3 %global github_owner gabrielfalcao %global github_name HTTPretty -%global modname httpretty +%global srcname httpretty # define these only if actually building from a GH snapshot not a release tarball #global github_commit 70af1f8cf925ef50cb5e72212fb0aa46e1451dc3 #global shortcommit %%(c=%%{github_commit}; echo ${c:0:7}) @@ -15,46 +15,23 @@ %global run_tests 1 Name: python-httpretty -Version: 0.9.5 +Version: 0.9.6 # If github_date is defined, assume a post-release snapshot -Release: 6%{?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 -URL: http://falcao.it/HTTPretty/ -Source0: https://files.pythonhosted.org/packages/source/h/httpretty/httpretty-%{version}.tar.gz +URL: https://github.com/%{github_owner}/%{github_name} +Source0: %{pypi_source} # Alternative for building from a github snapshot #Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{shortcommit}.tar.gz # Avoid unnecessary remote access requirement (note: test only actually # does a remote connection after PR #313) -Patch2: python-httpretty-fakesock_getpeercert_noconnect.patch - -# Fix a couple of issues with urllib 1.10 (as found in RHEL 6) -# https://github.com/gabrielfalcao/HTTPretty/pull/315 -Patch3: 0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch - -# Fix setUp and tearDown not calling reset -# https://github.com/gabrielfalcao/HTTPretty/pull/317 -Patch4: 0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch +Patch1: python-httpretty-fakesock_getpeercert_noconnect.patch BuildArch: noarch -BuildRequires: python2-devel -BuildRequires: python2-setuptools -# For tests -BuildRequires: python2-httplib2 -BuildRequires: python2-mock -BuildRequires: python2-nose -BuildRequires: python2-requests -BuildRequires: python2-sure -BuildRequires: python2-urllib3 -BuildRequires: python2-tornado -%if 0%{?epel} == 6 -# Need unittest2 to get the 'skip' decorator -BuildRequires: python-unittest2 -%endif - %global _description\ Once upon a time a python developer wanted to use a RESTful API, everything was\ fine but until the day he needed to test the code that hits the RESTful API:\ @@ -64,28 +41,45 @@ Don't worry, HTTPretty is here for you. %description %_description +%if %{with python2} %package -n python2-httpretty Summary: %summary -Requires: python2-six +Requires: python%{?fedora:2}-six + +BuildRequires: python2-devel +BuildRequires: python2-setuptools +# For tests +BuildRequires: python%{?fedora:2}-httplib2 +BuildRequires: python%{?fedora:2}-mock +BuildRequires: python%{?fedora:2}-nose +BuildRequires: python%{?fedora:2}-requests +BuildRequires: python%{?fedora:2}-sure +BuildRequires: python%{?fedora:2}-urllib3 +BuildRequires: python%{?fedora:2}-tornado +%if 0%{?epel} == 6 +# Need unittest2 to get the 'skip' decorator +BuildRequires: python-unittest2 +%endif %{?python_provide:%python_provide python2-httpretty} %description -n python2-httpretty %_description +%endif -%if 0%{?with_python3} +%if %{with python3} %package -n python3-httpretty Summary: HTTP request mock tool for Python 3 -Requires: python3-six +Requires: python%{python3_pkgversion}-six -BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools # For tests -BuildRequires: python3-httplib2 -BuildRequires: python3-mock -BuildRequires: python3-nose -BuildRequires: python3-requests -BuildRequires: python3-sure -BuildRequires: python3-urllib3 -BuildRequires: python3-tornado +BuildRequires: python%{python3_pkgversion}-httplib2 +BuildRequires: python%{python3_pkgversion}-mock +BuildRequires: python%{python3_pkgversion}-nose +BuildRequires: python%{python3_pkgversion}-requests +BuildRequires: python%{python3_pkgversion}-sure +BuildRequires: python%{python3_pkgversion}-urllib3 +BuildRequires: python%{python3_pkgversion}-tornado %description -n python3-httpretty Once upon a time a python developer wanted to use a RESTful API, everything was @@ -106,39 +100,49 @@ sed -i 's/^with-randomly = 1$//' setup.cfg sed -i 's/^rednose = 1$//' setup.cfg %build +%if %{with python2} # setup.py contains non-ASCII characters; in Koji build environment # default encoding is ASCII and this will choke, so set a UTF-8 locale LANG=C.UTF-8 %py2_build +%endif -%if 0%{?with_python3} +%if %{with_python3} %py3_build %endif %install +%if %{with python2} LANG=C.UTF-8 %py2_install +%endif -%if 0%{?with_python3} +%if %{with_python3} %py3_install %endif %check %if %{run_tests} -LANG=C.UTF-8 %{__python2} -m nose -v -%if 0%{?with_python3} +%if %{with python2} +LANG=C.UTF-8 %{__python2} -m nose -v +%endif + +%if %{with_python3} %{__python3} -m nose -v %endif + %endif +%if %{with python2} %files -n python2-httpretty %doc README.rst %license COPYING %{python2_sitelib}/httpretty %{python2_sitelib}/httpretty-%{version}-py2.?.egg-info +%endif -%if 0%{?with_python3} +%if %{with_python3} %files -n python3-httpretty %doc README.rst %license COPYING @@ -148,6 +152,10 @@ LANG=C.UTF-8 %{__python2} -m nose -v %changelog +* Tue Jul 30 2019 Jiri Popelka - 0.9.6-1 +- Update to 0.9.6 +- Disable python2 subpackage on F30+ + * Fri Jul 26 2019 Fedora Release Engineering - 0.9.5-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sources b/sources index 6e13cdc..8410db4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (httpretty-0.9.5.tar.gz) = 21c3e8f39796c426952056a8248934ac56f185b3a0ca016579f0717e2230bf0763c331d2f522a248fff7a3d36be3fa929d24fba636e13281230c02c8ba25659c +SHA512 (httpretty-0.9.6.tar.gz) = bc1c64d34370209c732bc12dd9935600b647507ab2c8f18c85f348e9b5e853618ba39e10e5a073b35036e6cbe3db2cb7a342a721d0e4affa81fe178fd0b75d92