diff --git a/python-packaging.spec b/python-packaging.spec index 743cc11..4140d05 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -8,6 +8,9 @@ # Specify --without docs to prevent the dependency loop on python-sphinx %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 python3_wheelname %python2_wheelname @@ -25,29 +28,35 @@ BuildArch: noarch %if 0%{?fedora} || 0%{?rhel} >= 8 BuildRequires: python2-setuptools BuildRequires: python2-devel -BuildRequires: python2-pytest BuildRequires: python2-pyparsing +%if %{with tests} +BuildRequires: python2-pytest +%endif %else BuildRequires: python-setuptools BuildRequires: python-devel -BuildRequires: pytest BuildRequires: pyparsing +%if %{with tests} +BuildRequires: pytest +BuildRequires: python2-pretend +%endif %if %{with docs} BuildRequires: python-sphinx %endif %endif -BuildRequires: python2-pretend BuildRequires: python2-six # Build Python 3 subpackage only for Fedora %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-pytest -BuildRequires: python%{python3_pkgversion}-pretend BuildRequires: python%{python3_pkgversion}-pyparsing BuildRequires: python%{python3_pkgversion}-six +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-pretend +%endif %if %{with docs} BuildRequires: python%{python3_pkgversion}-sphinx %endif @@ -152,6 +161,7 @@ rm -rf html/_static/fonts/ %endif %endif +%if %{with tests} %check %if 0%{?fedora} || 0%{?rhel} >= 8 %{__python2} -m pytest tests/ @@ -160,6 +170,7 @@ rm -rf html/_static/fonts/ # Disable non-working tests in Epel7 %{__python2} -m pytest --ignore=tests/test_requirements.py tests/ %endif +%endif %files -n python2-%{pypi_name} %license LICENSE LICENSE.APACHE LICENSE.BSD