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