testtools.testsuite.ConcurrentStreamTestSuite(object)
class documentationtesttools.testsuite
(View In Hierarchy)
Method | __init__ | Create a ConcurrentTestSuite to execute tests returned by make_tests. |
Method | run | Run the tests concurrently. |
Method | _run_test | Undocumented |
Parameters | make_tests | A helper function that should return some number of concurrently executable test suite / test case objects. make_tests must take no parameters and return an iterable of tuples. Each tuple must be of the form (case, route_code), where case is a TestCase-like object with a run(result) method, and route_code is either None or a unicode string. |
Run the tests concurrently.
This calls out to the provided make_tests helper to determine the concurrency to use and to assign routing codes to each worker.
ConcurrentTestSuite provides no special mechanism to stop the tests returned by make_tests, it is up to the made tests to honour the shouldStop attribute on the result object they are run with, which will be set if the test run is to be aborted.
The tests are run with an ExtendedToStreamDecorator wrapped around a StreamToQueue instance. ConcurrentStreamTestSuite dequeues events from the queue and forwards them to result. Tests can therefore be either original unittest tests (or compatible tests), or new tests that emit StreamResult events directly.
Parameters | result | A StreamResult instance. The caller is responsible for calling startTestRun on this instance prior to invoking suite.run, and stopTestRun subsequent to the run method returning. |