From 399e1711ea24b82626c1e633154177ff0bdd5a57 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 9 May 2024 11:35:25 +0000 Subject: [PATCH] Omit pytest-mock test dependency and associated tests on RHEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit is cherry picked from Fedora. Resolves: RHEL-35432 Cherry-picked-by: Lukáš Zaoral Upstream-commit: 20e8aa3d2ad35820ae1fec007cb862c4af4e649c --- python-meson-python.spec | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/python-meson-python.spec b/python-meson-python.spec index 6d2101d..5811947 100644 --- a/python-meson-python.spec +++ b/python-meson-python.spec @@ -1,4 +1,7 @@ %bcond tests 1 +# The python-pytest-mock dependency is unwanted on RHEL; we can omit it and +# still run most of the tests. +%bcond pytest_mock %{undefined rhel} Name: python-meson-python Summary: Meson Python build backend (PEP 517) @@ -52,6 +55,9 @@ Requires: /usr/bin/patchelf # build: used only by skipped PEP 518 test # pytest-cov: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters sed -r -i "s/^ '(build|pytest-cov)/#&/" pyproject.toml +%if %{without pytest_mock} +sed -r -i "s/^ '(pytest-mock)/#&/" pyproject.toml +%endif %generate_buildrequires @@ -69,9 +75,18 @@ sed -r -i "s/^ '(build|pytest-cov)/#&/" pyproject.toml %check %if %{with tests} -# PEP 518 tests require network access. # Note: tests are *not* safe for parallel execution with pytest-xdist. -%pytest --ignore=tests/test_pep518.py + +# PEP 518 tests require network access. +ignore="${ignore-} --ignore=tests/test_pep518.py" + +%if %{without pytest_mock} +k="${k-}${k+ and }not test_invalid_build_dir" +k="${k-}${k+ and }not test_use_ansi_colors" +%endif + +%pytest ${ignore-} -k "${k-}" + %else %pyproject_check_import %endif