From 02536540768555dde6d675935db45df81bcab7bf Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Sep 10 2020 05:51:07 +0000 Subject: Use versioned pytest executable in `%pytest` macro for non-main Python stack --- diff --git a/macros.python3 b/macros.python3 index cfd8019..714d9ca 100644 --- a/macros.python3 +++ b/macros.python3 @@ -73,7 +73,7 @@ } # This is intended for Python 3 only, hence also no Python version in the name. -%__pytest /usr/bin/pytest +%__pytest /usr/bin/pytest%(test %{python3_pkgversion} == 3 || echo -%{python3_version}) %pytest %{expand:\\\ CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ PATH="%{buildroot}%{_bindir}:$PATH"\\\ diff --git a/tests/test_evals.py b/tests/test_evals.py index 5c8db71..20af7ca 100644 --- a/tests/test_evals.py +++ b/tests/test_evals.py @@ -188,6 +188,13 @@ def test_pytest_different_command(): assert 'pytest-3' in lines[-1] +def test_pytest_command_suffix(): + lines = rpm_eval('%pytest -v') + assert '/usr/bin/pytest -v' in lines[-1] + lines = rpm_eval('%pytest -v', python3_pkgversion="3.6", python3_version="3.6") + assert '/usr/bin/pytest-3.6 -v' in lines[-1] + + def test_pypi_source_default_name(): url = rpm_eval('%pypi_source', name='foo', version='6')[0]