diff --git a/macros.python b/macros.python index 0d29ae0..0ba4d78 100644 --- a/macros.python +++ b/macros.python @@ -169,7 +169,7 @@ print(_python_macro_cache[cache_key][name]) PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\ PYTHONDONTWRITEBYTECODE=1\\\ %{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"}\\\ - PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus}} + PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:-%{_smp_build_ncpus}}"} %python_disable_dependency_generator() \ %undefine __pythondist_requires \ diff --git a/macros.python3 b/macros.python3 index a813557..7197433 100644 --- a/macros.python3 +++ b/macros.python3 @@ -119,7 +119,7 @@ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\ PYTHONDONTWRITEBYTECODE=1\\\ %{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"}\\\ - PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus}} + PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:-%{_smp_build_ncpus}}"} # This is intended for Python 3 only, hence also no Python version in the name. %__pytest /usr/bin/pytest%(test %{python3_pkgversion} == 3 || echo -%{python3_version}) diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index 8b5fba3..06fc622 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -53,7 +53,7 @@ elseif posix.stat('macros.python-srpm') then end } Version: %{__default_python3_version} -Release: 6%{?dist} +Release: 7%{?dist} BuildArch: noarch @@ -163,6 +163,9 @@ grep -E '^#[^%%]*%%[^%%]' %{buildroot}%{rpmmacrodir}/macros.* && exit 1 || true %changelog +* Thu Jan 25 2024 Miro HronĨok - 3.12-7 +- %%py3_test_envvars: Only set $PYTEST_XDIST_AUTO_NUM_WORKERS if not already set + * Mon Jan 22 2024 Fedora Release Engineering - 3.12-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/tests/test_evals.py b/tests/test_evals.py index 69f689e..1f953e0 100644 --- a/tests/test_evals.py +++ b/tests/test_evals.py @@ -324,7 +324,7 @@ def test_pytest_command_suffix_alternate_pkgversion(version): def test_pytest_sets_pytest_xdist_auto_num_workers(): lines = rpm_eval('%pytest', _smp_build_ncpus=2) - assert 'PYTEST_XDIST_AUTO_NUM_WORKERS=2' in '\n'.join(lines) + assert 'PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:-2}"' in '\n'.join(lines) def test_pytest_undefined_addopts_are_not_set(): @@ -374,7 +374,7 @@ def test_py3_test_envvars(lib, __pytest_addopts): assert 'PATH="BUILDROOT/usr/bin:$PATH"' in stripped_lines assert 'CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"' in stripped_lines assert 'PYTHONDONTWRITEBYTECODE=1' in stripped_lines - assert 'PYTEST_XDIST_AUTO_NUM_WORKERS=3' in stripped_lines + assert 'PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:-3}"' in stripped_lines if __pytest_addopts: assert f'PYTEST_ADDOPTS="${{PYTEST_ADDOPTS:-}} {__pytest_addopts}"' in stripped_lines else: