1concurrencytest 2=============== 3 4![testing goats](https://raw.github.com/cgoldberg/concurrencytest/master/testing-goats.png "testing goats") 5 6Python testtools extension for running unittest suites concurrently. 7 8---- 9 10Install from PyPI: 11``` 12pip install concurrencytest 13``` 14 15---- 16 17Requires: 18 19* [testtools](https://pypi.python.org/pypi/testtools) : `pip install testtools` 20* [python-subunit](https://pypi.python.org/pypi/python-subunit) : `pip install python-subunit` 21 22---- 23 24Example: 25 26```python 27import time 28import unittest 29 30from concurrencytest import ConcurrentTestSuite, fork_for_tests 31 32 33class SampleTestCase(unittest.TestCase): 34 """Dummy tests that sleep for demo.""" 35 36 def test_me_1(self): 37 time.sleep(0.5) 38 39 def test_me_2(self): 40 time.sleep(0.5) 41 42 def test_me_3(self): 43 time.sleep(0.5) 44 45 def test_me_4(self): 46 time.sleep(0.5) 47 48 49# Load tests from SampleTestCase defined above 50suite = unittest.TestLoader().loadTestsFromTestCase(SampleTestCase) 51runner = unittest.TextTestRunner() 52 53# Run tests sequentially 54runner.run(suite) 55 56# Run same tests across 4 processes 57suite = unittest.TestLoader().loadTestsFromTestCase(SampleTestCase) 58concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests(4)) 59runner.run(concurrent_suite) 60``` 61Output: 62 63``` 64.... 65---------------------------------------------------------------------- 66Ran 4 tests in 2.003s 67 68OK 69.... 70---------------------------------------------------------------------- 71Ran 4 tests in 0.504s 72 73OK 74``` 75