On 12. 07. 22 11:50, Miro Hrončok wrote:
On 12. 07. 22 11:25, Petr Viktorin wrote:
>>>
>>> Or pytest-xdist could be taught to check an environment variable for
>>> `auto`, making this seamless for packagers?
>>
>> This could work, except that sometimes pytest-xdist is installed and we
>> don't want to run tests in parallel because they are not prepared for that.
>> But I guess an opt-out would still exist, e.g. setting %{_smp_build_ncpus}
>> to 1 in the %check section.
>>
>> I will have a look if there is an environment variable we could use. We can
>> probably adjust PYTEST_ADDOPTS if we detect pytest-xdist is available.
>
> I meant teaching pytest-xdist to look at an envvar, which would just be
> ignored if xdist isn't around.
> Actually I just went ahead and proposed it upstream:
>
https://github.com/pytest-dev/pytest-xdist/issues/792
Oh, now I get it. Perfect!
A followup:
Petr's change was merged to pytest-xdsit:
https://github.com/pytest-dev/pytest-xdist/pull/829
I've drafted a change for %pytest:
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/149
Change for %tox will follow.
Packages that call pytest directly (i.e. not by the macros) won't benefit from
this change.
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok