Add a tests bcond

This commit is contained in:
Miro Hrončok
2023-06-14 18:08:43 +02:00
parent 016585cd11
commit eb01aeacf9
+5 -1
View File
@@ -11,6 +11,8 @@ BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros
%bcond tests 1
%description
The tox-current-env plugin allows to run tests in current Python environment.
@@ -29,7 +31,7 @@ The tox-current-env plugin allows to run tests in current Python environment.
%generate_buildrequires
# Don't use %%pyproject_buildrequires -t/-e to avoid a build dependency loop
%pyproject_buildrequires -x tests
%pyproject_buildrequires %{?with_tests:-x tests}
%build
@@ -45,8 +47,10 @@ The tox-current-env plugin allows to run tests in current Python environment.
# hooks[34].py are imported in hooks.py based on tox version so we have to
# exclude them here.
%pyproject_check_import -e '*.hooks?'
%if %{with tests}
# deselected tests run tox without the options for this plugin and hence they need internet
%pytest -k "not regular and not noquiet_installed_packages[None]"
%endif
%files -n python%{python3_pkgversion}-tox-current-env -f %{pyproject_files}