Package qm :: Package test :: Module execution_thread :: Class ExecutionThread
[hide private]
[frames] | no frames]

Class ExecutionThread

source code

                  object --+        
                           |        
          threading._Verbose --+    
                               |    
                threading.Thread --+
                                   |
execution_engine.ExecutionEngine --+
                                   |
                                  ExecutionThread

A 'ExecutionThread' executes tests in a separate thread.

A 'ExecutionThread' is an 'ExecutionEngine' that runs tests in a separate thread.

This class schedules the tests, plus the setup and cleanup of any resources they require, across one or more targets.

The shedule is determined dynamically as the tests are executed based on which targets are idle and which are not. Therefore, the testing load should be reasonably well balanced, even across a heterogeneous network of testing machines.

Instance Methods [hide private]
 
__init__(self, database, test_ids, context, targets, result_streams=None, expectations=None)
Set up a test run.
source code
 
run(self)
Run the tests.
source code
 
RequestTermination(self)
Request termination.
source code
 
_IsTerminationRequested(self)
Returns true if termination has been requested.
source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from threading.Thread (private): _reset_internal_locks, _set_daemon, _set_ident

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from execution_engine.ExecutionEngine: AddInputHandler, Run

Inherited from execution_engine.ExecutionEngine (private): _RunTests, _Trace, _WriteInitialAnnotations

Properties [hide private]

Inherited from threading.Thread: daemon, ident, name

Inherited from threading.Thread (private): _block

Inherited from object: __class__

Method Details [hide private]

__init__(self, database, test_ids, context, targets, result_streams=None, expectations=None)
(Constructor)

source code 

Set up a test run.

'database' -- The 'Database' containing the tests that will be run.

'test_ids' -- A sequence of IDs of tests to run. Where possible, the tests are started in the order specified.

'context' -- The context object to use when running tests.

'targets' -- A sequence of 'Target' objects, representing targets on which tests may be run.

'result_streams' -- A sequence of 'ResultStream' objects. Each stream will be provided with results as they are available. This thread will not perform any locking of these streams as they are written to; each stream must provide its own synchronization if it will be accessed before 'run' returns.

'expectations' -- If not 'None', a dictionary mapping test IDs to expected outcomes.

Overrides: execution_engine.ExecutionEngine.__init__

run(self)

source code 

Run the tests.

This method runs the tests specified in the __init__ function.

Overrides: threading.Thread.run

RequestTermination(self)

source code 

Request termination.

Request that the execution thread be terminated. This may take some time; tests that are already running will continue to run, for example.

Overrides: execution_engine.ExecutionEngine.RequestTermination

_IsTerminationRequested(self)

source code 

Returns true if termination has been requested.

return -- True if Terminate has been called.

Overrides: execution_engine.ExecutionEngine._IsTerminationRequested