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.
Methods
|
|
GetTarget
RunTest
Stop
_RunTest
_Stop
_Trace
__init__
run
|
|
GetTarget
|
GetTarget ( self )
Return the Target associated with this thread.
- returns
- The
Target with which this thread is associated.
Derived classes must not override this method.
|
|
RunTest
|
RunTest (
self,
descriptor,
context,
)
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
|
Stop ( self )
Stop the thread.
Derived classes must not override this method.
|
|
_RunTest
|
_RunTest (
self,
descriptor,
context,
)
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
|
_Stop ( self )
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
|
_Trace ( self, message )
Write a trace message .
-
message
- A string to be output as a trace message.
|
|
__init__
|
__init__ ( self, target )
Construct a new CommandThread .
-
target
- The
Target that owns this thread.
|
|
run
|
run ( self )
Execute the thread.
|
|