Skip to main content

Parallel unit test runner with coverage support

Project description

unittest-parallel

PyPI - Status PyPI GitHub PyPI - Python Version

unittest-parallel is a parallel unit test runner for Python with coverage support.

Links

Run Unit Tests in Parallel

To run unittest-parallel, specify the directory containing your unit tests with the -s argument and your package's top-level directory using the -t argument:

unittest-parallel -t . -s tests

By default, unittest-parallel runs unit test modules on all CPU cores available.

To run your unit tests with coverage, add either the --coverage option (for line coverage) or the --coverage-branch for line and branch coverage.

unittest-parallel -t . -s tests --coverage-branch

Parallelism Level

By default, unittest-parallel runs test modules in parallel, which works with test class and module fixtures. If you don't have any module fixtures, you can use the --level=class option to run test classes in parallel. If you don't have any module or class fixtures, you can use the --level=test option to run individual tests in parallel.

Do I Need unittest-parallel?

unittest-parallel helps the most when you have many long-running unit tests, such as those that make web service calls or are compute-intensive. If you just have many fast-running unit tests, unittest-parallel may slow down unit test execution due to the cost of parallelization.

For example, for one of my projects with thousands of compute-intensive unit tests, running tests with unittest-parallel is five times faster than running tests using Python's built-in unit test runner.

For another project, with hundreds of fast-running unit tests, running tests using unittest-parallel is twice as slow as running them using Python's built-in unit test runner.

To determine if unittest-parallel will improve your unit test run times, you'll need to try it on your project.

Development

This package is developed using python-build. It was started using python-template as follows:

template-specialize python-template/template/ unittest-parallel/ -k package unittest-parallel -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapi 1

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

unittest-parallel-1.6.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unittest_parallel-1.6.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file unittest-parallel-1.6.0.tar.gz.

File metadata

  • Download URL: unittest-parallel-1.6.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for unittest-parallel-1.6.0.tar.gz
Algorithm Hash digest
SHA256 1a17ec895d11ea61cb38c643bc6b1fd2c3643ef117472d3b521b476c91491b8f
MD5 f58d18a35eef62149898abae87a380da
BLAKE2b-256 3f6f75468a8446684f92bc03fe70b1c79661cb63955d7aedcc16ffb1fb093d15

See more details on using hashes here.

File details

Details for the file unittest_parallel-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unittest_parallel-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6014a745144f620a1a3b4bea0f6d9678d02d2ab67bb70e1b0277543917236fb0
MD5 0d7237e998217a2076df7a9acf379b70
BLAKE2b-256 80351d95277091558c9955e79cbe30a30f3f4820071aced304edc10c5eff4e02

See more details on using hashes here.

Supported by

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