Fedora Account System
Red Hat Associate
Red Hat Customer
Unfortunately, setting the PYTEST_XDIST_AUTO_NUM_WORKERS environment variable when running pytest-xdist's tests breaks the tests because the tests try to exercise all the different ways of configuring the number of workers and setting the env var interferes with this. Would it be reasonable to provide some sort of way to disable setting of this env var? If not, I can just not use %pytest in pytest-xdist. Thanks.
We set other environment variables like this: PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" Would doing this serve your needs? PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:-%{_smp_build_ncpus}}" That way, you could export PYTEST_XDIST_AUTO_NUM_WORKERS= (nothing) which should be enough to ignore it: https://github.com/pytest-dev/pytest-xdist/blob/v3.1.0/src/xdist/plugin.py#L16-L17 Such addition might be useful to others, as this will be possible: PYTEST_XDIST_AUTO_NUM_WORKERS=5 %pytest Without %pytest overriding it back. That said, we should probably fix pytest-xdist own test suite to work even when PYTEST_XDIST_AUTO_NUM_WORKERS is set from the outside. I'll take a look.
> That said, we should probably fix pytest-xdist own test suite to work even when PYTEST_XDIST_AUTO_NUM_WORKERS is set from the outside. I'll take a look. Followed up in bz2161636.
(In reply to Miro Hrončok from comment #1) > We set other environment variables like this: > > > PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}: > %{buildroot}%{python3_sitelib}}" > > Would doing this serve your needs? > > > PYTEST_XDIST_AUTO_NUM_WORKERS="${PYTEST_XDIST_AUTO_NUM_WORKERS:- > %{_smp_build_ncpus}}" > > That way, you could export PYTEST_XDIST_AUTO_NUM_WORKERS= (nothing) which > should be enough to ignore it: > > https://github.com/pytest-dev/pytest-xdist/blob/v3.1.0/src/xdist/plugin. > py#L16-L17 > > > Such addition might be useful to others, as this will be possible: > > PYTEST_XDIST_AUTO_NUM_WORKERS=5 %pytest > > Without %pytest overriding it back. > > > That said, we should probably fix pytest-xdist own test suite to work even > when PYTEST_XDIST_AUTO_NUM_WORKERS is set from the outside. I'll take a look. Yes, this sounds great, but obviously a very low priority, especially in light of the other fix you did.
This works: $ PYTEST_XDIST_AUTO_NUM_WORKERS=5 $ echo ${PYTEST_XDIST_AUTO_NUM_WORKERS:-3} 5 It is however impossible to opt-out completely by setting to an empty value: $ PYTEST_XDIST_AUTO_NUM_WORKERS= $ echo ${PYTEST_XDIST_AUTO_NUM_WORKERS:-3} 3 I don't know if that's possible in Shell. But OTOH I don't think many packages would ned that.
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/158
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.