Skip to main content

Python testtools extension for running unittest suites concurrently

Project description

concurrencytest

testing goats

Python testtools extension for running unittest suites concurrently.


  • Development: GitHub
  • Download/Install: PyPI
  • License: GPLv2+
  • Copyright (c) 2013-2026 Corey Goldberg
  • Original code from:
    • Bazaar (bzrlib.tests.__init__.py, v2.6, copied Jun 01 2013)
    • Copyright (c) 2005-2011 Canonical Ltd

Install from PyPI:

pip install concurrencytest

Requires:


Example:

import time
import unittest

from concurrencytest import ConcurrentTestSuite, fork_for_tests


class SampleTestCase(unittest.TestCase):
    """Dummy tests that sleep for demo."""

    def test_me_1(self):
        time.sleep(0.5)

    def test_me_2(self):
        time.sleep(0.5)

    def test_me_3(self):
        time.sleep(0.5)

    def test_me_4(self):
        time.sleep(0.5)


# Load tests from SampleTestCase defined above
suite = unittest.TestLoader().loadTestsFromTestCase(SampleTestCase)
runner = unittest.TextTestRunner()

# Run tests sequentially
runner.run(suite)

# Run same tests across 4 processes
suite = unittest.TestLoader().loadTestsFromTestCase(SampleTestCase)
concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests(4))
runner.run(concurrent_suite)

# Run same tests across all available CPU cores (1 processes per core)
suite = unittest.TestLoader().loadTestsFromTestCase(SampleTestCase)
concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests())
runner.run(concurrent_suite)

Output:

.....
----------------------------------------------------------------------
Ran 4 tests in 2.002s

OK
....
----------------------------------------------------------------------
Ran 4 tests in 0.510s

OK
....
----------------------------------------------------------------------
Ran 4 tests in 0.507s

OK

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

concurrencytest-0.1.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

concurrencytest-0.1.5-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file concurrencytest-0.1.5.tar.gz.

File metadata

  • Download URL: concurrencytest-0.1.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for concurrencytest-0.1.5.tar.gz
Algorithm Hash digest
SHA256 bfe57c56c66898e527752e59b47a78af456965bdbc80425b051f4dcb308e0d70
MD5 93d08f6897f5d6f8ce562ea3b432fd9b
BLAKE2b-256 a7a50d3a8749b1b84c41fa9b256c240d1071bb00ebd1485fe06542c630cc8330

See more details on using hashes here.

File details

Details for the file concurrencytest-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for concurrencytest-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aaff34522de9b8a4a0c62637f9f1bf3847bdb8d354eb215e4434cd900964edcb
MD5 19bd3bb2e7180060ff74e8667516250d
BLAKE2b-256 cc0c93a694de6ac4c9030002309144f564e7a27f159a1d6ccc03a7d30dd6b4f8

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