Python testtools extension for running unittest test suites concurrently
Project description
concurrencytest
Python testtools extension for running unittest test 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
- Bazaar (
Install from PyPI:
pip install concurrencytest
Requires:
- support for
os.fork()(Unix-like systems only) - testtools :
pip install testtools - python-subunit :
pip install python-subunit
Example:
import time
import unittest
from concurrencytest import ConcurrentTestSuite, fork_for_tests
class ExampleTestCase(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)
runner = unittest.TextTestRunner()
# Run the tests from above sequentially
suite = unittest.TestLoader().loadTestsFromTestCase(ExampleTestCase)
runner.run(suite)
# Run same tests concurrently across 4 processes
suite = unittest.TestLoader().loadTestsFromTestCase(ExampleTestCase)
concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests(4))
runner.run(concurrent_suite)
# Run same tests concurrently using 1 process per available CPU core
suite = unittest.TestLoader().loadTestsFromTestCase(ExampleTestCase)
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
Release history Release notifications | RSS feed
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.6.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file concurrencytest-0.1.6.tar.gz.
File metadata
- Download URL: concurrencytest-0.1.6.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c7e31b7ffa3693fd4efdb3fe09470b1098b859b67d22c886171506aa1a3f62
|
|
| MD5 |
06a23fff3de17ce0819f60b795d79521
|
|
| BLAKE2b-256 |
2ea64e88cf2eb5144f74031c65d70af4e60db7983127422a7b5d016ebd46be86
|
File details
Details for the file concurrencytest-0.1.6-py3-none-any.whl.
File metadata
- Download URL: concurrencytest-0.1.6-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e17463cc34499f2b254a88210afff8e7170ed4c0c37c1b6b9ca4fa4b8c36785
|
|
| MD5 |
e38ab5c53bb569c7479ab260c7687ebd
|
|
| BLAKE2b-256 |
ad17f68eddefe2624a50ccb8c6cec363761495eeccd3a91ed596de84d63a348b
|