# pytest-parallel
a pytest plugin for parallel and concurrent testing
## What?
This plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).
## Why?
`pytest-xdist` is great to run tests that:
1. aren't threadsafe
2. perform poorly when multithreaded
3. need state isolation
`pytest-parallel` is better for some use cases (like Selenium tests) that:
1. can be threadsafe
2. can use non-blocking IO for http requests to make it performant
3. manage little or no state in the Python environment
Put simply, `pytest-xdist` does parallelism while `pytest-parallel` does parallelism and concurrency.
## Requirements
* Python3 version [3.6+]
* Unix or Mac for `--workers`
* Unix, Mac, or Windows for `--tests-per-worker`
## Installation
`pip install pytest-parallel`
## 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**.
* `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
```bash
# runs 2 workers with 1 test per worker at a time
pytest --workers 2
# runs 4 workers (assuming a quad-core machine) with 1 test per worker
pytest --workers auto
# runs 1 worker with 4 tests at a time
pytest --tests-per-worker 4
# runs 1 worker with up to 50 tests at a time
pytest --tests-per-worker auto
# runs 2 workers with up to 50 tests per worker
pytest --workers 2 --tests-per-worker auto
```
## Notice
Beginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.
Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.
[Source](https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods)
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/browsertron/pytest-parallel",
"name": "pytest-parallel",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Browsertron",
"author_email": "team@browsertron.com",
"download_url": "https://files.pythonhosted.org/packages/ed/0e/a74218b99ae0fbab09fabc0ad01e763b32abbeaa96a27188782e9d6289db/pytest-parallel-0.1.1.tar.gz",
"platform": "",
"description": "# pytest-parallel\na pytest plugin for parallel and concurrent testing\n\n## What?\n\nThis plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).\n\n## Why?\n\n`pytest-xdist` is great to run tests that:\n 1. aren't threadsafe\n 2. perform poorly when multithreaded\n 3. need state isolation\n\n`pytest-parallel` is better for some use cases (like Selenium tests) that:\n 1. can be threadsafe\n 2. can use non-blocking IO for http requests to make it performant\n 3. manage little or no state in the Python environment\n\nPut simply, `pytest-xdist` does parallelism while `pytest-parallel` does parallelism and concurrency.\n\n## Requirements\n\n* Python3 version [3.6+]\n* Unix or Mac for `--workers`\n* Unix, Mac, or Windows for `--tests-per-worker`\n\n## Installation\n\n`pip install pytest-parallel`\n\n## Options\n\n* `workers` (optional) - max workers (aka processes) to start. Can be a **positive integer or `auto`** which uses one worker per core. **Defaults to 1**.\n* `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**.\n\n## Examples\n\n```bash\n# runs 2 workers with 1 test per worker at a time\npytest --workers 2\n\n# runs 4 workers (assuming a quad-core machine) with 1 test per worker\npytest --workers auto\n\n# runs 1 worker with 4 tests at a time\npytest --tests-per-worker 4\n\n# runs 1 worker with up to 50 tests at a time\npytest --tests-per-worker auto\n\n# runs 2 workers with up to 50 tests per worker\npytest --workers 2 --tests-per-worker auto\n```\n\n## Notice\n\nBeginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.\n\n Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.\n\n[Source](https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods)\n\n## License\n\nMIT\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "a pytest plugin for parallel and concurrent testing",
"version": "0.1.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d1b502946186470889fa1c6551057ff8",
"sha256": "9e3703015b0eda52be9e07d2ba3498f09340a56d5c79a39b50f22fc5c38212fe"
},
"downloads": -1,
"filename": "pytest_parallel-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d1b502946186470889fa1c6551057ff8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6967,
"upload_time": "2021-10-10T15:39:19",
"upload_time_iso_8601": "2021-10-10T15:39:19.068736Z",
"url": "https://files.pythonhosted.org/packages/14/d2/a2cf7da29753a222d19a682d50fb3cb605544cec66770553611119c857d2/pytest_parallel-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "8779d17a8da9cdb45145a8ca27a7db5d",
"sha256": "9aac3fc199a168c0a8559b60249d9eb254de7af58c12cee0310b54d4affdbfab"
},
"downloads": -1,
"filename": "pytest-parallel-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "8779d17a8da9cdb45145a8ca27a7db5d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9547,
"upload_time": "2021-10-10T15:39:20",
"upload_time_iso_8601": "2021-10-10T15:39:20.209315Z",
"url": "https://files.pythonhosted.org/packages/ed/0e/a74218b99ae0fbab09fabc0ad01e763b32abbeaa96a27188782e9d6289db/pytest-parallel-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-10-10 15:39:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "browsertron",
"github_project": "pytest-parallel",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pytest-parallel"
}