kevlened / pytest-parallel

A pytest plugin for parallel and concurrent testing
https://github.com/browsertron/pytest-parallel/issues/104#issuecomment-1293941066
MIT License
313 stars 59 forks source link

Control auto worker count through environment variable #110

Open kburns opened 2 years ago

kburns commented 2 years ago

Hello and thanks for the great package! I think it could be useful to allow the user to set an environment variable that determines the number of workers to use with --workers auto, maybe something like PYTEST_AUTO_WORKERS, and fallback to the current behavior using os.cpu_count() if that environment variable is not set. Is that a feature you might be interested in? If so I'd be happy to put in a PR.

The use case I have in mind is when you have a workflow that tests with pytest-parallel and the automatic worker count, but on some machines (e.g. when running on your laptop instead of a workstation or cluster) you might want to prevent pytest from using all available cores to keep the UI responsive, etc.