-
Notifications
You must be signed in to change notification settings - Fork 239
Description
Would you accept a PR to read an environment variable when determining what -n auto
means?
Concrete use case:
We're trying to make testing easier in Fedora RPM builds, where one should ideally use a somewhat obscure macro (%{_smp_build_ncpus}
) for the best number of processes on a builder machine, but many packagers simply reuse upstream projects' command lines, with -n auto
. It would be nice if we could set e.g. PYTEST_XDIST_AUTO_NUM_WORKERS
in our default pytest
environment, and document -n auto
as best practice for pytest-xdist.
Doing this in the plugin hook (pytest_xdist_auto_num_workers
) would probably be possible, but very cumbersome compared to an environment variable.
I assume there are other use cases where this would be useful.
I'm thinking the pytest_xdist_auto_num_workers
hook should have priority if both it and the env var are specified: for having it the other way. it's fairly easy to check the env var from a plugin.