From aefb7ee682d55bbcabbbae7c7864e3564d362b6b Mon Sep 17 00:00:00 2001 From: Sandro Date: Feb 21 2024 12:29:35 +0000 Subject: Clean up spec file - Define test dependencies manually - Drop mangling of *requirements.txt (obsolete) - Run all tests by default --- diff --git a/python-xnat.spec b/python-xnat.spec index 3723974..ee13c74 100644 --- a/python-xnat.spec +++ b/python-xnat.spec @@ -1,6 +1,6 @@ -# Require network, so run locally in mock with --with=tests --enable-network -# All tests pass -%bcond tests 0 +# Tests requiring network are skipped (mostly dependent on docker) +# So, let's run all tests by default. +%bcond tests 1 # Use forge macros for pulling from GitLab %global forgeurl https://gitlab.com/radiology/infrastructure/xnatpy @@ -20,6 +20,8 @@ Release: %autorelease Summary: XNAT client that exposes XNAT objects/functions as python objects/functions # Only expand forge macros in fedora >= 40 since %%forgesource is broken # in older releases. +# Use `fedpkg ... mockbuild --srpm-mock ...` when building for >=40 on +# system <40 %if %{fedora} >= 40 %forgemeta %endif @@ -42,6 +44,12 @@ Summary: %{summary} BuildRequires: python3-devel BuildRequires: help2man +%if %{with tests} +BuildRequires: python3-pytest +BuildRequires: python3-pytest-mock +BuildRequires: python3-requests-mock +BuildRequires: python3-xnat4tests +%endif %description -n python3-xnat %{desc} @@ -49,17 +57,13 @@ BuildRequires: help2man %prep %autosetup -p1 -n xnatpy-%{version} -# Remove version locks etc. -sed -i -e 's/pytest==.*/pytest/' -e 's/pytest-cov==.*/pytest-cov/' -e '/tox/ d' test_requirements.txt -sed -i '/sphinx/d' requirements.txt - # remove shebang from non executable scripts sed -i '1d' xnat/scripts/copy_project.py sed -i '1d' xnat/scripts/data_integrity_check.py sed -i '1d' xnat/scripts/import_experiment_dir.py %generate_buildrequires -%pyproject_buildrequires %{?with_tests: -r requirements.txt test_requirements.txt} +%pyproject_buildrequires -r requirements.txt %build %pyproject_wheel