python3.14-pytest/SPECS/python3.14-pytest.spec
2026-04-16 04:59:10 -04:00

163 lines
5.2 KiB
RPMSpec

## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 3;
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 python3_pkgversion 3.14
Name: python%{python3_pkgversion}-pytest
Version: 8.3.5
Release: %autorelease
Summary: Simple powerful testing with Python
# SPDX
License: MIT
URL: https://pytest.org
Source: %{pypi_source pytest %{version}}
# Compatibility fix for attrs 25.2+
Patch: https://github.com/pytest-dev/pytest/pull/13291.patch
# Officially support Python 3.14
# This fixes/xfails Python 3.14 test failures
# Rebased from https://github.com/pytest-dev/pytest/pull/13440
Patch: 13440.patch
# Fix compatibility with Twisted 25
# Rebased from https://github.com/pytest-dev/pytest/pull/13502
Patch: 13502.patch
# Fix test_doctest_unexpected_exception on Python 3.14
Patch: https://github.com/pytest-dev/pytest/pull/13548.patch
# Remove -s from Python shebang,
# ensure that packages installed with pip to user locations are testable
# https://bugzilla.redhat.com/2152171
%undefine _py3_shebang_s
# When building pytest for the first time with new Python version
# we might not yet have all the BRs, those conditionals allow us to do that.
# This can be used to disable all tests for faster bootstrapping.
# The tests are enabled by default except when building on RHEL/ELN
# (to avoid pulling in extra dependencies into next RHEL).
%bcond tests %{undefined rhel}
# Only disabling the optional tests is a more complex but careful approach
# Pytest will skip the related tests, so we only conditionalize the BRs
%bcond optional_tests %{with tests}
# To run the tests in %%check we use pytest-timeout
# When building pytest for the first time with new Python version
# that is not possible as it depends on pytest
%bcond timeout %{with tests}
# When building pytest for the first time with new Python version
# we also don't have sphinx yet and cannot build docs.
# The docs are enabled by default except when building on RHEL/ELN
# (to avoid pulling in extra dependencies into next RHEL).
%bcond docs %{undefined rhel}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros >= 0-51
%if %{with tests}
# we avoid using %%pyproject_buildrequires -x testing as it mixes optional and non-optional deps
BuildRequires: python%{python3_pkgversion}-attrs >= 19.2
BuildRequires: python%{python3_pkgversion}-hypothesis >= 3.56
BuildRequires: python%{python3_pkgversion}-pygments >= 2.7.2
BuildRequires: python%{python3_pkgversion}-xmlschema
%if %{with optional_tests}
BuildRequires: python%{python3_pkgversion}-argcomplete
BuildRequires: python%{python3_pkgversion}-decorator
BuildRequires: python%{python3_pkgversion}-jinja2
BuildRequires: python%{python3_pkgversion}-mock
BuildRequires: python%{python3_pkgversion}-numpy
BuildRequires: python%{python3_pkgversion}-pexpect
BuildRequires: python%{python3_pkgversion}-pytest-xdist
BuildRequires: python%{python3_pkgversion}-twisted
BuildRequires: /usr/bin/lsof
%endif
%if %{with timeout}
BuildRequires: python%{python3_pkgversion}-pytest-timeout
%endif
%endif
BuildRequires: %{_bindir}/rst2html
BuildArch: noarch
%description
The pytest framework makes it easy to write small tests, yet scales to support
complex functional testing for applications and libraries.
%prep
%autosetup -p1 -n pytest-%{version}
# documentation dependencies missing in Fedora
sed -i '/sphinxcontrib-towncrier/d' doc/en/requirements.txt
sed -i '/sphinxcontrib\.towncrier/d' doc/en/conf.py
sed -i '/sphinx_issues/d' doc/en/conf.py
sed -i '/sphinx-issues/d' doc/en/requirements.txt
%generate_buildrequires
%pyproject_buildrequires -r
%build
%pyproject_wheel
for f in README CHANGELOG CONTRIBUTING ; do
rst2html ${f}.rst > ${f}.html
done
%install
%pyproject_install
%pyproject_save_files _pytest pytest py
mv %{buildroot}%{_bindir}/pytest %{buildroot}%{_bindir}/pytest-%{python3_version}
mv %{buildroot}%{_bindir}/py.test %{buildroot}%{_bindir}/py.test-%{python3_version}
# remove shebangs from all scripts
find %{buildroot}%{python3_sitelib} \
-name '*.py' \
-exec sed -i -e '1{/^#!/d}' {} \;
%check
%if %{with tests}
%global __pytest %{buildroot}%{_bindir}/pytest
# optional_tests deps contain pytest-xdist, so we can use it to run tests faster
%pytest testing %{?with_timeout:--timeout=30} %{?with_optional_tests:-n auto} -rs
%else
%pyproject_check_import
%endif
%files -n python%{python3_pkgversion}-pytest -f %{pyproject_files}
%doc CHANGELOG.html
%doc README.html
%doc CONTRIBUTING.html
%{_bindir}/pytest-%{python3_version}
%{_bindir}/py.test-%{python3_version}
%changelog
## START: Generated by rpmautospec
* Fri Nov 28 2025 Lukáš Zachar <lzachar@redhat.com> - 8.3.5-3
- Add gating
* Fri Nov 28 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 8.3.5-2
- Convert from Fedora for the Python 3.14 stack in RHEL
* Fri Nov 28 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 8.3.5-1
- RHEL: Rename SPEC to python3.14-pytest.spec
## END: Generated by rpmautospec