[Pyunit-interest] Code Theft: ParallelTestSuite from 2001
Brought to you by:
purcell
|
From: Honce, J. W <jho...@in...> - 2006-01-20 22:32:28
|
Has anyone updated this for the latest unittest? If I get it running,
I'll post. I'm new to python and unittest so any help/ideas would be
appreciated.=20
=20
--Jhon Honce
=20
=20
class ParallelTestSuite(unittest.TestSuite):
"""Runs its tests in parallel threads"""
def __call__(self, testResult):
from threading import Thread
threads =3D []
for test in self._tests:
result =3D test.defaultTestResult()
thread =3D Thread(target=3Dtest, args=3D(result,))
threads.append((test, thread, result))
thread.start()
for test, thread, result in threads:
thread.join()
testResult.startTest(test)
for error in result.errors:
apply(testResult.addError, error)
for failure in result.failures:
apply(testResult.addFailure, failure)
testResult.stopTest(test)
|