Skip to main content

a py.test plugin for parallel and concurrent testing

Project description

pytest-parallel

a py.test 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 parallelism

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

# 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

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-parallel-0.0.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

pytest_parallel-0.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest-parallel-0.0.3.tar.gz.

File metadata

  • Download URL: pytest-parallel-0.0.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for pytest-parallel-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4703c9c596abcce6c9af462a439fb72f07793bb0612ab2adbd9c3eecd211519f
MD5 08e44904f814e558411f4d4cf4b38fd8
BLAKE2b-256 17fd389584280aa12434ff6ecafdb702afb1be1b0cc9e81b671636e2f119de3a

See more details on using hashes here.

File details

Details for the file pytest_parallel-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pytest_parallel-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for pytest_parallel-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 de5f3b1f6b885315700086eb7f13858ebcf4057ea4d5d2aa9e4bf0c56015053f
MD5 472604c930ebc3347c35db8e0d8aa8a8
BLAKE2b-256 d804fa9f45be6468a331fa7b3a7f1e7494a13490d616b30d3c183d47d4fb36cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page