Expose the environment variables used by %pytest via %{py3_test_envvars}

This way, we will be able to reuse them in %tox from pyproject-rpm-macros.
Packagers will be able to use them in their spec files.

See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/A3QQSHP5OSLIVMCL52AR2GRBRXYQHU6B/
This commit is contained in:
Miro Hrončok 2022-10-24 17:47:59 +02:00
commit b647925300
4 changed files with 42 additions and 5 deletions

View file

@ -131,6 +131,16 @@
end
}
# Environment variables for testing used standalone, e.g.:
# %%{py_test_envvars} %%{python} -m unittest
%py_test_envvars %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
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}}
%python_disable_dependency_generator() \
%undefine __pythondist_requires \
%{nil}