Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Let auto worker count be set via environment variable #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Put simply, `pytest-xdist` does parallelism while `pytest-parallel` does paralle

## Options

* `workers` (optional) - max workers (aka processes) to start. Can be a **positive integer or `auto`** which uses one worker per core. **Defaults to 1**.
* `workers` (optional) - max workers (aka processes) to start. Can be a **positive integer or `auto`** which uses one worker per core or the number specified by the environment variable `PYTEST_AUTO_WORKERS`, if set. **Defaults to 1**.
* `tests-per-worker` (optional) - max concurrent tests per worker. Can be a **positive integer or `auto`** which evenly divides tests among the workers up to 50 concurrent tests. **Defaults to 1**.

## Examples
Expand Down
2 changes: 1 addition & 1 deletion pytest_parallel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def __init__(self, config):
workers = parse_config(config, 'workers')
try:
if workers == 'auto':
workers = os.cpu_count() or 1
workers = int(os.getenv("PYTEST_AUTO_WORKERS", os.cpu_count() or 1))
elif workers:
workers = int(workers)
else:
Expand Down