https://github.com/cgoldberg/concurrencytest
Python testtools extension for running unittest suites concurrently.
https://github.com/cgoldberg/concurrencytest
concurrency parallel test testing testtools unittest
Last synced: 6 months ago
JSON representation
Python testtools extension for running unittest suites concurrently.
- Host: GitHub
- URL: https://github.com/cgoldberg/concurrencytest
- Owner: cgoldberg
- License: gpl-2.0
- Created: 2013-06-05T17:26:53.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-03-16T21:34:12.000Z (7 months ago)
- Last Synced: 2025-03-29T15:02:44.894Z (6 months ago)
- Topics: concurrency, parallel, test, testing, testtools, unittest
- Language: Python
- Homepage: https://pypi.org/project/concurrencytest
- Size: 81.1 KB
- Stars: 56
- Watchers: 4
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
concurrencytest
===============
Python testtools extension for running unittest suites concurrently.
----
Install from PyPI:
```
pip install concurrencytest
```----
Requires:
* [testtools](https://pypi.python.org/pypi/testtools) : `pip install testtools`
* [python-subunit](https://pypi.python.org/pypi/python-subunit) : `pip install python-subunit`----
Example:
```python
import time
import unittestfrom 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)
```
Output:```
....
----------------------------------------------------------------------
Ran 4 tests in 2.003sOK
....
----------------------------------------------------------------------
Ran 4 tests in 0.504sOK
```