Omit pytest-mock test dependency and associated tests on RHEL
This commit is cherry picked from Fedora. Resolves: RHEL-35432 Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com> Upstream-commit: 20e8aa3d2ad35820ae1fec007cb862c4af4e649c
This commit is contained in:
parent
016703bc59
commit
399e1711ea
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user