Blame tests/python-httpbin.spec

a613e17
Name:           python-httpbin
a613e17
Version:        0.7.0
a613e17
Release:        0%{?dist}
a613e17
Summary:        HTTP Request & Response Service, written in Python + Flask
a613e17
License:        MIT
a613e17
URL:            https://github.com/Runscope/httpbin
a613e17
Source0:        %{url}/archive/v%{version}/httpbin-%{version}.tar.gz
a613e17
BuildArch:      noarch
a613e17
a613e17
BuildRequires:  python3-devel
a613e17
BuildRequires:  pyproject-rpm-macros
a613e17
3d85440
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
3d85440
# Wekrzeug in Fedora 37 isn't compatible with our httpbin
3d85440
Patch:          https://src.fedoraproject.org/rpms/python-httpbin/raw/0e4a7e2812/f/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch
3d85440
%endif
3d85440
50b5e63
# no flask, itsdangerous, raven, werkzeug packaged for EPEL 9 yet
50b5e63
# cannot run tests on EPEL and also cannot BuildRequire runtime deps
50b5e63
%if 0%{?fedora}
50b5e63
%bcond_without tests
50b5e63
%else
50b5e63
%bcond_with tests
50b5e63
%endif
50b5e63
a613e17
%description
a613e17
This package buildrequires a package with extra: raven[flask].
a613e17
a613e17
a613e17
%package -n python3-httpbin
a613e17
Summary:            %{summary}
a613e17
a613e17
%description -n python3-httpbin
a613e17
%{summary}.
a613e17
a613e17
a613e17
%prep
3d85440
%autosetup -n httpbin-%{version} -p1
a613e17
a613e17
# brotlipy wrapper is not packaged, httpbin works fine with brotli
a613e17
sed -i s/brotlipy/brotli/ setup.py
a613e17
a613e17
# update test_httpbin.py to reflect new behavior of werkzeug
a613e17
sed -i /Content-Length/d test_httpbin.py
a613e17
49b58d7
# https://github.com/postmanlabs/httpbin/issues/647
49b58d7
sed -Ei 's/\bdef (test_(relative_)?redirect_(to_post|n_(equals_to|higher_than)_1))/def no\1/' test_httpbin.py
a613e17
a613e17
%generate_buildrequires
50b5e63
%pyproject_buildrequires %{?with_tests:-t}%{?!with_tests:-R}
a613e17
a613e17
a613e17
%build
a613e17
%pyproject_wheel
a613e17
a613e17
a613e17
%install
a613e17
%pyproject_install
f392619
%pyproject_save_files -l httpbin
a613e17
a613e17
50b5e63
%if %{with tests}
a613e17
%check
a613e17
%tox
a613e17
a613e17
# Internal check for our macros
a613e17
# The runtime dependencies contain raven[flask], we assert we got them.
a613e17
# The %%tox above also dies without it, but this makes it more explicit
a613e17
%{python3} -c 'import blinker, flask'  # transitive deps
50b5e63
%endif
a613e17
a613e17
a613e17
%files -n python3-httpbin -f %{pyproject_files}
a613e17
%doc README*