Blame SPECS/python3.11-pytest.spec

128ae1
%global __python3 /usr/bin/python3.11
128ae1
%global python3_pkgversion 3.11
128ae1
128ae1
%global pkgname pytest
128ae1
128ae1
Name:           python%{python3_pkgversion}-pytest
128ae1
%global base_version 7.2.0
128ae1
#global prerelease ...
128ae1
Version:        %{base_version}%{?prerelease:~%{prerelease}}
128ae1
Release:        1%{?dist}
128ae1
Summary:        Simple powerful testing with Python
128ae1
License:        MIT
128ae1
URL:            https://pytest.org
128ae1
# see https://github.com/pytest-dev/pytest/issues/10042#issuecomment-1237132867
128ae1
Patch:          pytest-7.1.3-fix-xfails.patch
128ae1
Source0:        %{pypi_source pytest %{base_version}%{?prerelease}}
128ae1
128ae1
# RHEL: Disabled due to missing dependencies
128ae1
%bcond_with tests
128ae1
128ae1
# Only disabling the optional tests is a more complex but careful approach
128ae1
# Pytest will skip the related tests, so we only conditionalize the BRs
128ae1
# This bcond is ignored when tests are disabled
128ae1
%bcond_without optional_tests
128ae1
128ae1
# To run the tests in %%check we use pytest-timeout
128ae1
# When building pytest for the first time with new Python version
128ae1
# that is not possible as it depends on pytest
128ae1
# The bcond is ignored when tests are disabled
128ae1
%bcond_without timeout
128ae1
128ae1
BuildRequires:  python%{python3_pkgversion}-devel
128ae1
BuildRequires:  python%{python3_pkgversion}-rpm-macros
128ae1
BuildRequires:  python%{python3_pkgversion}-setuptools
128ae1
128ae1
# Those are also runtime deps, needed for tests
128ae1
# We keep them unconditionally, so we don't accidentally build pytest
128ae1
# before them and get broken dependencies
128ae1
BuildRequires:  python%{python3_pkgversion}-attrs >= 19.2
128ae1
BuildRequires:  python%{python3_pkgversion}-packaging
128ae1
BuildRequires:  python%{python3_pkgversion}-iniconfig
128ae1
BuildRequires:  python%{python3_pkgversion}-pluggy >= 0.12
128ae1
128ae1
Requires:  python%{python3_pkgversion}dist(attrs) >= 19.2
128ae1
Requires:  python%{python3_pkgversion}dist(packaging)
128ae1
Requires:  python%{python3_pkgversion}dist(iniconfig)
128ae1
Requires:  python%{python3_pkgversion}dist(pluggy) >= 0.12
128ae1
128ae1
%if %{with tests}
128ae1
BuildRequires:  python%{python3_pkgversion}-hypothesis >= 3.56
128ae1
BuildRequires:  python%{python3_pkgversion}-pygments >= 2.7.2
128ae1
BuildRequires:  python%{python3_pkgversion}-xmlschema
128ae1
%if %{with optional_tests}
128ae1
BuildRequires:  python%{python3_pkgversion}-argcomplete
128ae1
#BuildRequires:  python%{python3_pkgversion}-asynctest -- not packaged in Fedora
128ae1
BuildRequires:  python%{python3_pkgversion}-decorator
128ae1
BuildRequires:  python%{python3_pkgversion}-jinja2
128ae1
BuildRequires:  python%{python3_pkgversion}-mock
128ae1
BuildRequires:  python%{python3_pkgversion}-nose
128ae1
BuildRequires:  python%{python3_pkgversion}-numpy
128ae1
BuildRequires:  python%{python3_pkgversion}-pexpect
128ae1
BuildRequires:  python%{python3_pkgversion}-pytest-xdist
128ae1
BuildRequires:  python%{python3_pkgversion}-twisted
128ae1
BuildRequires:  /usr/bin/lsof
128ae1
%endif
128ae1
%if %{with timeout}
128ae1
BuildRequires:  python%{python3_pkgversion}-pytest-timeout
128ae1
%endif
128ae1
%endif
128ae1
128ae1
BuildRequires:  %{_bindir}/rst2html
128ae1
128ae1
BuildArch:      noarch
128ae1
128ae1
%description
128ae1
The pytest framework makes it easy to write small tests, yet scales to support
128ae1
complex functional testing for applications and libraries.
128ae1
128ae1
%prep
128ae1
%autosetup -p1 -n %{pkgname}-%{base_version}%{?prerelease}
128ae1
128ae1
128ae1
# remove setuptools_scm dependency since we don't have it in RHEL
128ae1
sed -i '/setuptools-scm/d' setup.cfg
128ae1
128ae1
# since setuptools_scm is not available we need to sed out it's usage from setup.py and set the correct version
128ae1
sed -i 's/setup()/setup(version="%{version}")/g' setup.py
128ae1
128ae1
128ae1
128ae1
128ae1
%build
128ae1
%py3_build
128ae1
128ae1
for f in README CHANGELOG CONTRIBUTING ; do
128ae1
  rst2html ${f}.rst > ${f}.html
128ae1
done
128ae1
128ae1
%install
128ae1
%py3_install
128ae1
mv %{buildroot}%{_bindir}/pytest %{buildroot}%{_bindir}/pytest-%{python3_version}
128ae1
mv %{buildroot}%{_bindir}/py.test %{buildroot}%{_bindir}/py.test-%{python3_version}
128ae1
128ae1
128ae1
# remove shebangs from all scripts
128ae1
find %{buildroot}%{python3_sitelib} \
128ae1
     -name '*.py' \
128ae1
     -exec sed -i -e '1{/^#!/d}' {} \;
128ae1
128ae1
%if %{with tests}
128ae1
%check
128ae1
%global __pytest %{buildroot}%{_bindir}/pytest
128ae1
# optional_tests deps contain pytest-xdist, so we can use it to run tests faster
128ae1
%pytest testing %{?with_timeout:--timeout=30} %{?with_optional_tests:-n auto} -rs
128ae1
%endif
128ae1
export PYTHONPATH=%{buildroot}%{python3_sitelib}
128ae1
test "$(%{python3} -c 'import pytest; print(pytest.__version__)')" == "%{version}"
128ae1
128ae1
%files -n python%{python3_pkgversion}-%{pkgname}
128ae1
%doc CHANGELOG.html
128ae1
%doc README.html
128ae1
%doc CONTRIBUTING.html
128ae1
%license LICENSE
128ae1
%{_bindir}/pytest-%{python3_version}
128ae1
%{_bindir}/py.test-%{python3_version}
128ae1
%{python3_sitelib}/pytest-*.egg-info/
128ae1
%{python3_sitelib}/_pytest/
128ae1
%{python3_sitelib}/pytest/
128ae1
%pycached %{python3_sitelib}/py.py
128ae1
128ae1
%changelog
128ae1
* Wed Oct 19 2022 Charalampos Stratakis <cstratak@redhat.com> - 7.2.0-1
128ae1
- Initial package
128ae1
- Fedora contributions by:
128ae1
      Charalampos Stratakis <cstratak@redhat.com>
128ae1
      David Malcolm <dmalcolm@redhat.com>
128ae1
      Dennis Gilmore <dennis@ausil.us>
128ae1
      Gwyn Ciesla <limburgher@gmail.com>
128ae1
      Igor Gnatenko <ignatenkobrain@fedoraproject.org>
128ae1
      Lumir Balhar <lbalhar@redhat.com>
128ae1
      Miro HronĨok <miro@hroncok.cz>
128ae1
      Nils Philippsen <nils@redhat.com>
128ae1
      Orion Poplawski <orion@cora.nwra.com>
128ae1
      Peter Robinson <pbrobinson@gmail.com>
128ae1
      Petr Viktorin <pviktori@redhat.com>
128ae1
      Richard Shaw <hobbes1069@gmail.com>
128ae1
      Robert Kuska <rkuska@redhat.com>
128ae1
      Thomas Moschny <thm@fedoraproject.org>