Add bcond for tests
This commit is contained in:
parent
a80880e08b
commit
2d040a4275
@ -8,6 +8,9 @@
|
|||||||
# Specify --without docs to prevent the dependency loop on python-sphinx
|
# Specify --without docs to prevent the dependency loop on python-sphinx
|
||||||
%bcond_without docs
|
%bcond_without docs
|
||||||
|
|
||||||
|
# Specify --without tests to prevent the dependency loop on python-pytest
|
||||||
|
%bcond_without tests
|
||||||
|
|
||||||
%global python2_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl
|
%global python2_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl
|
||||||
%global python3_wheelname %python2_wheelname
|
%global python3_wheelname %python2_wheelname
|
||||||
|
|
||||||
@ -25,29 +28,35 @@ BuildArch: noarch
|
|||||||
%if 0%{?fedora} || 0%{?rhel} >= 8
|
%if 0%{?fedora} || 0%{?rhel} >= 8
|
||||||
BuildRequires: python2-setuptools
|
BuildRequires: python2-setuptools
|
||||||
BuildRequires: python2-devel
|
BuildRequires: python2-devel
|
||||||
BuildRequires: python2-pytest
|
|
||||||
BuildRequires: python2-pyparsing
|
BuildRequires: python2-pyparsing
|
||||||
|
%if %{with tests}
|
||||||
|
BuildRequires: python2-pytest
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
BuildRequires: pytest
|
|
||||||
BuildRequires: pyparsing
|
BuildRequires: pyparsing
|
||||||
|
%if %{with tests}
|
||||||
|
BuildRequires: pytest
|
||||||
|
BuildRequires: python2-pretend
|
||||||
|
%endif
|
||||||
%if %{with docs}
|
%if %{with docs}
|
||||||
BuildRequires: python-sphinx
|
BuildRequires: python-sphinx
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildRequires: python2-pretend
|
|
||||||
BuildRequires: python2-six
|
BuildRequires: python2-six
|
||||||
|
|
||||||
# Build Python 3 subpackage only for Fedora
|
# Build Python 3 subpackage only for Fedora
|
||||||
%if 0%{?with_python3}
|
%if 0%{?with_python3}
|
||||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||||
BuildRequires: python%{python3_pkgversion}-devel
|
BuildRequires: python%{python3_pkgversion}-devel
|
||||||
BuildRequires: python%{python3_pkgversion}-pytest
|
|
||||||
BuildRequires: python%{python3_pkgversion}-pretend
|
|
||||||
BuildRequires: python%{python3_pkgversion}-pyparsing
|
BuildRequires: python%{python3_pkgversion}-pyparsing
|
||||||
BuildRequires: python%{python3_pkgversion}-six
|
BuildRequires: python%{python3_pkgversion}-six
|
||||||
|
%if %{with tests}
|
||||||
|
BuildRequires: python%{python3_pkgversion}-pytest
|
||||||
|
BuildRequires: python%{python3_pkgversion}-pretend
|
||||||
|
%endif
|
||||||
%if %{with docs}
|
%if %{with docs}
|
||||||
BuildRequires: python%{python3_pkgversion}-sphinx
|
BuildRequires: python%{python3_pkgversion}-sphinx
|
||||||
%endif
|
%endif
|
||||||
@ -152,6 +161,7 @@ rm -rf html/_static/fonts/
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
%if %{with tests}
|
||||||
%check
|
%check
|
||||||
%if 0%{?fedora} || 0%{?rhel} >= 8
|
%if 0%{?fedora} || 0%{?rhel} >= 8
|
||||||
%{__python2} -m pytest tests/
|
%{__python2} -m pytest tests/
|
||||||
@ -160,6 +170,7 @@ rm -rf html/_static/fonts/
|
|||||||
# Disable non-working tests in Epel7
|
# Disable non-working tests in Epel7
|
||||||
%{__python2} -m pytest --ignore=tests/test_requirements.py tests/
|
%{__python2} -m pytest --ignore=tests/test_requirements.py tests/
|
||||||
%endif
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
%files -n python2-%{pypi_name}
|
%files -n python2-%{pypi_name}
|
||||||
%license LICENSE LICENSE.APACHE LICENSE.BSD
|
%license LICENSE LICENSE.APACHE LICENSE.BSD
|
||||||
|
Loading…
Reference in New Issue
Block a user