Package qm :: Package test :: Module command_thread :: Class CommandThread
[hide private]
[frames] | no frames]

Class CommandThread

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        CommandThread

A 'CommandThread' is a thread that executes commands.

The commands are written to a 'Queue' by a controlling thread. The 'CommandThread' extracts the commands and dispatches them to derived class methods that process them. This class is used as a base class for thread classes used by some targets.

The commands are written to the 'Queue' as Python objects. The normal commands have the form '(method, descriptor, context)' where 'method' is a string. At present, the only value used for 'method' is '_RunTest'. In that case 'descriptor' is a test descriptor and 'context' is a 'Context'. The 'Stop' command is provided as a simple string, not a tuple.

Instance Methods [hide private]
 
__init__(self, target)
Construct a new 'CommandThread'.
source code
 
run(self)
Execute the thread.
source code
 
GetTarget(self)
Return the 'Target' associated with this thread.
source code
 
RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
source code
 
Stop(self)
Stop the thread.
source code
 
_RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
source code
 
_Stop(self)
Stop the thread.
source code
 
_Trace(self, message)
Write a trace 'message'.
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__

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, target)
(Constructor)

source code 

Construct a new 'CommandThread'.

'target' -- The 'Target' that owns this thread.

Overrides: object.__init__

run(self)

source code 

Execute the thread.

Overrides: threading.Thread.run

GetTarget(self)

source code 

Return the 'Target' associated with this thread.

returns -- The 'Target' with which this thread is associated.

Derived classes must not override this method.

RunTest(self, descriptor, context)

source code 

Run the test given by 'descriptor'.

'descriptor' -- The 'TestDescriptor' for the test to be run.

'context' -- The 'Context' in which to run the test.

This method is called by the controlling thread.

Derived classes must not override this method.

Stop(self)

source code 

Stop the thread.

Derived classes must not override this method.

_RunTest(self, descriptor, context)

source code 

Run the test given by 'descriptor'.

'descriptor' -- The 'TestDescriptor' for the test to be run.

'context' -- The 'Context' in which to run the test.

Derived classes must override this method.

_Stop(self)

source code 

Stop the thread.

This method is called in the thread after 'Stop' is called from the controlling thread. Derived classes can use this method to release resources before the thread is destroyed.

Derived classes may override this method.

_Trace(self, message)

source code 

Write a trace 'message'.

'message' -- A string to be output as a trace message.