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

Class CommandThread
source code

        object --+        
                 |        
          _Verbose --+    
                     |    
      threading.Thread --+
                         |
                        CommandThread
Known Subclasses:
classes.thread_target.LocalThread

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

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__


Class Variables [hide private]

Inherited from object: __class__


Method Details [hide private]

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.

__init__(self, target)
(Constructor)

source code 

Construct a new 'CommandThread'.

'target' -- The 'Target' that owns this thread.
Overrides: threading.Thread.__init__

run(self)

source code 
Execute the thread.
Overrides: threading.Thread.run