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

Class ExecutionThread
source code

                  object --+        
                           |        
                    _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.
  run(self)
Run the tests.
  RequestTermination(self)
Request termination.
  _IsTerminationRequested(self)
Returns true if termination has been requested.

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

Inherited from threading.Thread (private): _set_daemon

Inherited from threading._Verbose (private): _note

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

Inherited from execution_engine.ExecutionEngine: AddInputHandler, Run


Class Variables [hide private]

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: threading.Thread.__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