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
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to