Run the tests in %check in parallel with -n auto when possible

On my machine (8 workers), it changes the duration from 192.84s to 67.39s.
This commit is contained in:
Miro Hrončok 2021-12-15 20:07:51 +01:00
parent 2c2417a04b
commit 6626a910e3

View File

@ -135,8 +135,9 @@ find %{buildroot}%{python3_sitelib} \
%if %{with tests}
%check
%global __pytest %{buildroot}%{_bindir}/pytest
# optional_tests deps contain pytest-xdist, so we can use it to run tests faster
# test_errors_in_xfail_skip_expressions: https://github.com/pytest-dev/pytest/issues/9413
%pytest testing %{?with_timeout:--timeout=30} -rs -k "not test_errors_in_xfail_skip_expressions"
%pytest testing %{?with_timeout:--timeout=30} %{?with_optional_tests:-n auto} -rs -k "not test_errors_in_xfail_skip_expressions"
%endif