Blame SPECS/python3.11-pytest.spec

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