class ThreadedRunner(SimpleRunner): """Run tests using a threadpool. Uses TwistedPython's thread pool""" def __init__(self, result_class): from twisted.python.threadpool import ThreadPool SimpleRunner.__init__(self, _threadclass(result_class)) self._pool = ThreadPool() self._pool.start() def run(self, fixture): assert not self._done self._pool.dispatch(None, fixture, self._result) def result(self): self._pool.stop() return SimpleRunner.result(self)