## START: Set by rpmautospec
## (rpmautospec version 0.3.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    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 srcname pytest-asyncio
%global _description %{expand:
pytest-asyncio is an Apache2 licensed library, written in Python, for testing
asyncio code with pytest.

asyncio code is usually written in the form of coroutines, which makes it
slightly more difficult to test using normal testing tools. pytest-asyncio
provides useful fixtures and markers to make testing easier.}

%if 0%{?fedora}
# EL9 missing pytest-trio
%bcond_without  tests
%endif

Name:           python-%{srcname}
Version:        0.20.3
Release:        %autorelease
Summary:        Pytest support for asyncio
License:        ASL 2.0
URL:            https://github.com/pytest-dev/pytest-asyncio
Source:         %pypi_source
BuildArch:      noarch
BuildRequires:  python%{python3_pkgversion}-devel


%description %{_description}


%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{summary}


%description -n python%{python3_pkgversion}-%{srcname} %{_description}


%prep
%autosetup -n %{srcname}-%{version}

# disable code quality checks in "testing" extras
sed -e '/coverage >=/d' \
    -e '/mypy >=/d' \
    -i setup.cfg

%if %{defined el9}
# EL9 has setuptools_scm 6.0.1 that works
sed -e '/setuptools_scm/ s/>=6.2//' -i pyproject.toml
%endif

%if 0%{?rhel} >= 9
%generate_buildrequires
# upstream also has tox that invokes make that invokes pytest...
# we install the [testing] extra and will invoke pytest directly instead
%pyproject_buildrequires %{?with_tests:-x testing}
%endif

%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files pytest_asyncio


%check
%if %{with tests}
# tests/modes/test_legacy_mode.py fails when pytest is invoked by /usr/bin/pytest
# using python -m pytest works:
%global __pytest %{python3} -m pytest
%pytest
%else
%pyproject_check_import
%endif


%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files}
%doc README.rst CHANGELOG.rst


%changelog
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Wed Dec 21 2022 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 0.20.3-1
- Update to 0.20.3

* Sat Nov 12 2022 Julien Enselme <jujens@jujens.eu> - 0.20.2-1
- local build

* Tue Oct 25 2022 Federico Pellegrin <fede@evolware.org> - 0.20.1-1
- Update to 0.20.1

* Tue Aug 02 2022 Charalampos Stratakis <cstratak@redhat.com> - 0.19.0-1
- Update to 0.19.0

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

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.18.3-3
- Rebuilt for Python 3.11

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.18.3-2
- Bootstrap for Python 3.11

* Wed Apr 20 2022 Carl George <carl@george.computer> - 0.18.3-1
- Renamed from python3-pytest-asyncio (resolves: rhbz#2076825)
