New bcond tests

This commit is contained in:
Tomas Orsava 2019-11-20 17:30:03 +01:00
parent c3e5def138
commit db76a0acdc

View File

@ -1,7 +1,13 @@
# Note that the function of bootstrap is that it disables the test suite and whl
# bcond_with bootstrap = tests enabled, package with whl created
# The function of bootstrap is that it disables the wheel subpackage
%bcond_with bootstrap
# Default: when bootstrapping -> disable tests
%if %{with bootstrap}
%bcond_with tests
%else
%bcond_without tests
%endif
%global pypi_name wheel
%global python_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl
%global python_wheeldir %{_datadir}/python-wheels
@ -17,7 +23,7 @@ URL: https://github.com/pypa/wheel
Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%if %{without bootstrap}
%if %{with tests}
# several tests compile extensions
# those tests are skipped if gcc is not found
BuildRequires: gcc
@ -42,7 +48,7 @@ BuildRequires: python3-devel
# adds the dependency on python3-rpm-generators, so we require it manually
BuildRequires: python3-rpm-generators
BuildRequires: python3-setuptools
%if %{without bootstrap}
%if %{with tests}
BuildRequires: python3-pytest
%endif
%{?python_provide:%python_provide python3-%{pypi_name}}
@ -86,8 +92,10 @@ ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name}
%if %{without bootstrap}
mkdir -p %{buildroot}%{python_wheeldir}
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
%endif
%if %{with tests}
%check
rm setup.cfg
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build