Skip to main content

Parallel unit test runner for Python3 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.

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 tests 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

The coverage module is required for coverage support.

How it works

unittest-parallel uses Python's built-in unit test discovery to find all the test suites (TestCase classes) in your project. It then runs each test suite in a Python multi-processing pool of the requested size. Thus, the more test suites your unit tests are broken into, the better parallelization you'll get in your unit test runs.

Links

Usage

usage: unittest-parallel [-h] [-v] [-q] [-b] [-j COUNT] [--version] [-s START]
                         [-p PATTERN] [-t TOP] [--coverage]
                         [--coverage-branch] [--coverage-rcfile RCFILE]
                         [--coverage-include PAT] [--coverage-omit PAT]
                         [--coverage-source SRC] [--coverage-html DIR]
                         [--coverage-xml FILE] [--coverage-fail-under MIN]

options:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output
  -q, --quiet           Quiet output
  -b, --buffer          Buffer stdout and stderr during tests
  -j COUNT, --jobs COUNT
                        The number of test processes (default is 0, all cores)
  --version             show version number and quit

unittest options:
  -s START, --start-directory START
                        Directory to start discovery ('.' default)
  -p PATTERN, --pattern PATTERN
                        Pattern to match tests ('test*.py' default)
  -t TOP, --top-level-directory TOP
                        Top level directory of project (defaults to start
                        directory)

coverage options:
  --coverage            Run tests with coverage
  --coverage-branch     Run tests with branch coverage
  --coverage-rcfile RCFILE
                        Specify coverage configuration file
  --coverage-include PAT
                        Include only files matching one of these patterns.
                        Accepts shell-style (quoted) wildcards.
  --coverage-omit PAT   Omit files matching one of these patterns. Accepts
                        shell-style (quoted) wildcards.
  --coverage-source SRC
                        A list of packages or directories of code to be
                        measured
  --coverage-html DIR   Generate coverage HTML report
  --coverage-xml FILE   Generate coverage XML report
  --coverage-fail-under MIN
                        Fail if coverage percentage under min

Development

This project is developed using Python Build. Refer to the Python Build documentation for development instructions.

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.0.2.tar.gz (5.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: unittest-parallel-1.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for unittest-parallel-1.0.2.tar.gz
Algorithm Hash digest
SHA256 22fd3d202eade866147cef737b72fa7181db876af47a3bf9e13ab26fa3881c63
MD5 719087dd21d9d0f64325af6bc17d52e9
BLAKE2b-256 090152512c38d734938a4bd2ab4bac3d999810b85517be8bd0ffbc74334580d5

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