Fedora contributions by:
Charalampos Stratakis <cstratak@redhat.com>
David Malcolm <dmalcolm@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Gwyn Ciesla <limburgher@gmail.com>
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Karolina Surma <ksurma@redhat.com>
Lumír Balhar <lbalhar@redhat.com>
Maxwell G <maxwell@gtmx.me>
Miro Hrončok <mhroncok@redhat.com>
Nils Philippsen <nils@redhat.com>
Orion Poplawski <orion@cora.nwra.com>
Peter Robinson <pbrobinson@gmail.com>
Petr Viktorin <pviktori@redhat.com>
Richard Shaw <hobbes1069@gmail.com>
Robert Kuska <rkuska@redhat.com>
Stephen Gallagher <sgallagh@redhat.com>
Thomas Moschny <thomas.moschny@gmx.de>
Tomáš Hrnčiar <thrnciar@redhat.com>
Tomas Orsava <torsava@redhat.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
144 lines
4.5 KiB
RPMSpec
144 lines
4.5 KiB
RPMSpec
%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
|
|
%autochangelog
|