## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global pypi_name respx

Name:           python-%{pypi_name}
Version:        0.20.1
Release:        %autorelease
Summary:        Utility for mocking out the HTTPX and HTTP Core libraries

License:        BSD
URL:            https://lundberg.github.io/respx/
Source0:        https://github.com/lundberg/respx/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

# Fix test failures with httpx >= 0.24
# Upstream: https://github.com/lundberg/respx/pull/231
Patch0:         231.patch

%description
An utility for mocking out the Python HTTPX and HTTP Core libraries.

%package -n     python3-%{pypi_name}
Summary:        %{summary}

BuildRequires:  python3-devel
BuildRequires:  python3dist(httpx)
BuildRequires:  python3dist(httpcore)
BuildRequires:  python3dist(flask)
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(starlette)
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-cov)
BuildRequires:  python3dist(pytest-asyncio)
BuildRequires:  python3dist(trio)
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
An utility for mocking out the Python HTTPX and HTTP Core libraries.

%prep
%autosetup -n %{pypi_name}-%{version} -p1
rm -rf %{pypi_name}.egg-info
# Coverage is under 100 % due to the excluded tests
sed -i -e '/--cov-fail-under 100/d' setup.cfg

%build
%py3_build

%install
%py3_install

%check
%pytest -v tests -k "not test_pass_through" --asyncio-mode=auto

%files -n python3-%{pypi_name}
%license LICENSE.md
%doc README.md
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/

%changelog
* Mon May 15 2023 František Zatloukal <fzatlouk@redhat.com> - 0.20.1-1
- Update to 0.20.1 (Fixes RHBZ#2126802 and RHBZ#2143791  )

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.19.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Aug 04 2022 František Zatloukal <fzatlouk@redhat.com> - 0.19.2-5
- Temp switch of pytest-asyncio to legacy to fix build against Flask >= 2.2

* Tue Aug 02 2022 Charalampos Stratakis <cstratak@redhat.com> - 0.19.2-4
- Fix test failures with pytest-asyncio >= 0.19

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.19.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 0.19.2-2
- Rebuilt for Python 3.11

* Sun Mar 06 2022 Fabian Affolter <mail@fabian-affolter.ch> - 0.19.2-1
- Update to latest upstream release 0.19.2 (closes rhbz#2046909)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.17.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Aug 26 2021 Fabian Affolter <mail@fabian-affolter.ch> - 0.17.1-1
- * Thu Aug 26 2021 Fabian Affolter <mail@fabian-affolter.ch> - 0.17.1-1 -
  Update to latest upstream release 0.17.1 (closes rhbz#1954159)

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.16.3-3
- Rebuilt for Python 3.10

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Mon Dec 14 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.3-1
- * Mon Dec 14 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.3-1 -
  Update to latest upstream release 0.16.3 (#1907495)

* Fri Dec 11 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.2-1
- * Fri Dec 11 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.2-1 -
  Update to latest upstream release 0.16.2 (#1904258)

* Thu Dec 03 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.0-1
- * Thu Dec 03 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.16.0-1 -
  Update to latest upstream release 0.16.0

* Wed Nov 18 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.14.0-1
- * Sat Oct 17 2020 Fabian Affolter <mail@fabian-affolter.ch> - 0.14.0-1 -
  Initial package for Fedora