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