CI tests: Make python-pytest.spec build with Python 3.10+

Preserve compatibility with Fedora 33.

Related: rhbz#1950291
This commit is contained in:
Miro Hrončok 2021-06-17 11:08:36 +00:00
parent 71f414ef2c
commit 73495ac0fe
1 changed files with 21 additions and 0 deletions

View File

@ -1,12 +1,28 @@
%global pypi_name pytest
Name: python-%{pypi_name}
# For testing purposes, we package different versions on different Fedoras,
# because otherwise we would miss some dependencies (pytest 6.2 needs tox 3.20+)
# Please, don't write spec files like this in Fedora, it is forbidden.
%if 0%{?fedora} > 33 || 0%{?rhel} > 9
Version: 6.2.4
%else
Version: 4.4.2
%endif
Release: 0%{?dist}
Summary: Simple powerful testing with Python
License: MIT
URL: https://pytest.org
Source0: %{pypi_source}
%if v"%{version}" >= v"6.2"
# Fix Python 3.10 test issues
# Merged upstream, https://github.com/pytest-dev/pytest/pull/8555
# Rebased slightly
Patch2: https://src.fedoraproject.org/rpms/pytest/raw/a368ab2b2249b5d03a145f1d8b70e5636fc6eca8/f/8555.patch
%endif
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: pyproject-rpm-macros
@ -29,6 +45,11 @@ Summary: %{summary}
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
# Remove duplicate '>=' in setup.cfg
# https://github.com/pytest-dev/pytest/pull/8336
# https://github.com/pytest-dev/pytest/pull/8774
sed -i 's/>=>=/>=/' setup.cfg
%generate_buildrequires
%pyproject_buildrequires -x testing -t