%bcond_with dotests
%define RST2HTML rst2html
%global __tar /opt/freeware/bin/tar
%global py_major 3.9
%global py_minor 16
%global python_major python%{py_major}
%global pkgname pytest
%global meta_package python3-%{pkgname}
%global python3_sitearch %(%{python_major} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(0))")
Name: %{python_major}-%{pkgname}
Version: 5.3.1
Release: 2
Summary: Simple powerful testing with Python
License: MIT
URL: https://pypi.python.org/pypi/%{pkgname}
Source0: https://files.pythonhosted.org/packages/source/p/%{pkgname}/%{pkgname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: %{python_major}-devel >= %{py_major}.%{py_minor}
BuildRequires: %{python_major}-setuptools >= 65.2.0
BuildRequires: %{python_major}-docutils >= 0.19
Requires: %{python_major}-attrs >= 19.3.0
Requires: %{python_major}-more-itertools >= 7.2.0
Requires: %{python_major}-packaging >= 19.2
Requires: %{python_major}-pluggy >= 0.13.0
Requires: %{python_major}-py >= 1.8.0
Requires: %{python_major}-wcwidth >= 0.1.7
Requires: %{python_major} >= %{py_major}.%{py_minor}
%description
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.
%package -n %{meta_package}
Summary: Meta-package for %{name}
Requires: python3 >= %{py_major}.%{py_minor}
Requires: python3-attrs >= 19.3.0
Requires: python3-more-itertools >= 7.2.0
Requires: python3-packaging >= 19.2
Requires: python3-pluggy >= 0.13.0
Requires: python3-py >= 1.8.0
Requires: python3-wcwidth >= 0.1.7
Requires: %{name} = %{version}-%{release}
%description -n %{meta_package}
This is a Meta-package for %{name} package.
%prep
%autosetup -n %{pkgname}-%{version}
%build
export PATH=/opt/freeware/bin:$PATH
%{python_major} setup.py build
#for l in doc/* ; do
# make -C $l html PYTHONPATH=$(pwd)/src
#done
for f in README CHANGELOG CONTRIBUTING ; do
%{RST2HTML} ${f}.rst > ${f}.html
done
%install
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
%{python_major} setup.py install --root %{buildroot}
cd %{buildroot}%{_bindir}
mv pytest pytest-%{py_major}
ln -sf pytest-%{py_major} %{buildroot}%{_bindir}/pytest-3
ln -sf pytest-%{py_major} %{buildroot}%{_bindir}/pytest
mv py.test py.test-%{py_major}
ln -sf py.test-%{py_major} %{buildroot}%{_bindir}/py.test-3
ln -sf py.test-%{py_major} %{buildroot}%{_bindir}/py.test
cd -
#mkdir -p _htmldocs/html
#for l in doc/* ; do
# remove hidden file
# rm ${l}/_build/html/.buildinfo
# mv ${l}/_build/html _htmldocs/html/${l##doc/}
#done
# remove shebangs from all scripts
find %{buildroot}%{python3_sitearch} \
-name '*.py' \
find %{buildroot}%{python3_sitearch} \
-name '*.py' \
-exec sed -i -e '1{/^#!/d}' {} \;
%check
%if %{with dotests}
#python3 -m venv python_venv
#. ./python_venv/bin/activate
#pip3 install pytest
#pip3 install hypothesis
#ulimit -d unlimited
#ulimit -n unlimited
#ulimit -m unlimited
# ulimit -f unlimited
#( python runtests.py -m 'full' -v || true )
#deactivate
%endif
%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-,root,system,-)
%license LICENSE
%doc CHANGELOG.html README.html CONTRIBUTING.html _htmldocs/html
%{_bindir}/*%{py_major}
%{python3_sitearch}/*
%files -n %{meta_package}
%defattr(-,root,system,-)
%{_bindir}/*
%exclude %{_bindir}/*%{py_major}
%changelog
* Fri Mar 24 2023 Reshma V Kumar - 5.3.1-2
- Pytest for python3.9
* Mon Nov 18 2019 Baanu Tumma - 5.2.1-1
- update to 5.2.1
* Wed Sep 20 2017 Ravi Hirekurabar - 3.1.3-1
- Updated to 3.1.3
* Wed May 10 2017 Michael Wilson - 3.0.7-1
- Update to version 3.0.7
* Tue Jun 11 2013 Tristan Delhalle - 2.3.5-1
- first version for AIX V6.1 and higher