From 7f08c76c1e35191707f4c5c913e83ee4f2d5df75 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Wed, 3 Aug 2022 16:12:46 +0200 Subject: [PATCH] Update a test From-source-git-commit: 44a9b748a24253fb483f3338f7ae145ca90b7178 Signed-off-by: Jiri Popelka --- python-httpretty.spec | 13 +++-- python-httpretty.spec.orig | 99 ++++++++++++++++++++++++++++++++++++++ test_handle_slashes.patch | 28 +++++++++++ 3 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 python-httpretty.spec.orig create mode 100644 test_handle_slashes.patch diff --git a/python-httpretty.spec b/python-httpretty.spec index 196ec7f..421b95e 100644 --- a/python-httpretty.spec +++ b/python-httpretty.spec @@ -17,18 +17,17 @@ Summary: HTTP request mock tool for Python License: MIT URL: https://github.com/%{github_owner}/%{github_name} 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 - +Patch2: skip-test_passthrough.patch # Remove timeout, which causes some tests to fail in Koji -# +# # Fixes RHBZ#2046877 -Patch3: test_response-no-within.patch +Patch3: test_response-no-within.patch +# https://github.com/gabrielfalcao/HTTPretty/issues/457 +Patch4: test_handle_slashes.patch BuildArch: noarch diff --git a/python-httpretty.spec.orig b/python-httpretty.spec.orig new file mode 100644 index 0000000..e081568 --- /dev/null +++ b/python-httpretty.spec.orig @@ -0,0 +1,99 @@ +%global github_owner gabrielfalcao +%global github_name 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}) +#global github_date 20161011 + +%if 0%{?fedora} +%global run_tests 1 +%else +# missing deps in epel9 +%global run_tests 0 +%endif + +Name: python-httpretty +Version: 1.1.4 +# If github_date is defined, assume a post-release snapshot +Release: 9%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} +Summary: HTTP request mock tool for Python + +License: MIT +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 + +BuildArch: noarch + +%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:\ +what if the API server is down? What if its content has changed?\ +Don't worry, HTTPretty is here for you. + +%description %_description + +%package -n python3-httpretty +Summary: HTTP request mock tool for Python 3 +Requires: python%{python3_pkgversion}-six + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +%if %{run_tests} +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 +BuildRequires: python%{python3_pkgversion}-eventlet +BuildRequires: python%{python3_pkgversion}-freezegun +BuildRequires: python%{python3_pkgversion}-redis +%endif + +%description -n python3-httpretty +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: +what if the API server is down? What if its content has changed? +Don't worry, HTTPretty is here for you. + + +%prep +%autosetup -n httpretty-%{version} -p1 + +# Alternative for building from commit tarball +#autosetup -n %%{github_name}-%%{github_commit} -p1 + +# nose plugins we don't have yet +sed -i 's/^with-randomly = 1$//' setup.cfg +sed -i 's/^rednose = 1$//' setup.cfg + +%build +%py3_build + +%install +%py3_install + +%check +%if %{run_tests} +%{__python3} -m nose -v +%endif + +%files -n python3-httpretty +%doc README.rst +%license COPYING +%{python3_sitelib}/httpretty +%{python3_sitelib}/httpretty-%{version}-py%{python3_version}.egg-info + + +%changelog +* Fri Jul 22 2022 Fedora Release Engineering - 1.1.4-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jun 16 2022 Python Maint - 1.1.4-8 +- Rebuilt for Python 3.11 + +%autochangelog diff --git a/test_handle_slashes.patch b/test_handle_slashes.patch new file mode 100644 index 0000000..2af8850 --- /dev/null +++ b/test_handle_slashes.patch @@ -0,0 +1,28 @@ +From 44a9b748a24253fb483f3338f7ae145ca90b7178 Mon Sep 17 00:00:00 2001 +From: Jiri Popelka +Date: Wed, 3 Aug 2022 15:51:54 +0200 +Subject: [PATCH 4/4] Update + test_httpretty_should_handle_paths_starting_with_two_slashes + +http.server.BaseHTTPRequestHandler.parse_request() now replaces '//' with '/'. +https://github.com/python/cpython/pull/93879 + +Patch-name: test_handle_slashes.patch +Patch-status: https://github.com/gabrielfalcao/HTTPretty/issues/457 +--- + tests/functional/test_requests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py +index 752428b..59e36b0 100644 +--- a/tests/functional/test_requests.py ++++ b/tests/functional/test_requests.py +@@ -946,4 +946,4 @@ def test_httpretty_should_handle_paths_starting_with_two_slashes(): + response = requests.get('http://example.com//foo') + expect(response.text).to.equal('Find the best foo') + expect(HTTPretty.last_request.method).to.equal('GET') +- expect(HTTPretty.last_request.path).to.equal('//foo') ++ expect(HTTPretty.last_request.path).to.equal('/foo') +-- +2.37.1 +