Hello Pythonistas,
while working on a change that requires adding a new Shell environment variable
to both %pytest and %tox, I figured out we might benefit from defining such
variables at one place.
Maxwell suggested that this place should be exposed to packagers, so they could
use it with other test runners.
In
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/149 we
propose to use it like this:
%check
%{python3_test_envvars} %{python3} -m unittest
Or:
%check
%{python3_test_envvars} stestr run
The macro would currently be defined as:
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}"
LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \
PATH="%{buildroot}%{_bindir}:$PATH" \
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}
Some of the variables are pytest-specific, but some are useful with other test
runners as well.
I am writing this email to raise awareness and get some feedback, if needed.
As always, the most important question is the bikeshed color^W^W macro name.
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok