Package qm :: Package test :: Package classes :: Module thread_target :: Class ThreadTarget
[hide private]
[frames] | no frames]

Class ThreadTarget

source code

         object --+        
                  |        
extension.Extension --+    
                      |    
          target.Target --+
                          |
                         ThreadTarget

A target implementation that runs tests in local threads.

Each thread executes one test or resource at a time.

Nested Classes [hide private]

Inherited from extension.Extension: Type, __metaclass__

Instance Methods [hide private]
 
__init__(self, database, properties)
Construct a 'ThreadTarget'.
source code
 
IsIdle(self)
Return true if the target is idle.
source code
 
Start(self, response_queue, engine=None)
Start the target.
source code
 
Stop(self)
Stop the target.
source code
 
RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
source code
 
_RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
source code
 
_RecordResult(self, result)
Record the 'result'.
source code
 
_BeginResourceSetUp(self, resource_name)
Begin setting up the indicated resource.
source code
 
_FinishResourceSetUp(self, resource, result, properties)
Finish setting up a resource.
source code
 
_NoteIdleThread(self)
Note that the current thread.
source code
 
_Trace(self, message)
Write a trace 'message'.
source code
 
_GetTemporaryDirectory(self)
Return the path to a temporary directory.
source code

Inherited from target.Target: GetDatabase, GetGroup, GetName, IsInGroup

Inherited from target.Target (private): _CleanUpResource, _SetUpResource

Inherited from extension.Extension: GetClassName, GetExplicitArguments, MakeDomDocument, MakeDomElement, Write, __getattr__

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

Class Variables [hide private]
  arguments = [qm.fields.IntegerField(name= "threads", title= "N...
A list of the arguments to the extension class.

Inherited from target.Target: kind

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, database, properties)
(Constructor)

source code 

Construct a 'ThreadTarget'.

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

'properties' -- A dictionary mapping strings (property names) to strings (property values).

Overrides: object.__init__

IsIdle(self)

source code 

Return true if the target is idle.

returns -- True if the target is idle. If the target is idle, additional tasks may be assigned to it.

Overrides: target.Target.IsIdle

Start(self, response_queue, engine=None)

source code 

Start the target.

'response_queue' -- The 'Queue' in which the results of test executions are placed.

'engine' -- The 'ExecutionEngine' that is starting the target, or 'None' if this target is being started without an 'ExecutionEngine'.

Overrides: target.Target.Start

Stop(self)

source code 

Stop the target.

postconditions -- The target may no longer be used.

Overrides: target.Target.Stop

RunTest(self, descriptor, context)

source code 

Run the test given by 'descriptor'.

'descriptor' -- The 'TestDescriptor' for the test.

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

Derived classes may override this method.

Overrides: target.Target.RunTest

_RunTest(self, descriptor, context)

source code 

Run the test given by 'descriptor'.

'descriptor' -- The 'TestDescriptor' for the test.

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

This method will be called from the thread that has been assigned the test.

_RecordResult(self, result)

source code 

Record the 'result'.

'result' -- A 'Result' of a test or resource execution.

Overrides: target.Target._RecordResult

_BeginResourceSetUp(self, resource_name)

source code 

Begin setting up the indicated resource.

'resource_name' -- A string naming a resource.

returns -- If the resource has already been set up, returns a tuple '(outcome, map)'. The 'outcome' indicates the outcome that resulted when the resource was set up; the 'map' is a map from strings to strings indicating properties added by this resource. Otherwise, returns 'None', but marks the resource as in the process of being set up; it is the caller's responsibility to finish setting it up by calling '_FinishResourceSetUp'.

Overrides: target.Target._BeginResourceSetUp

_FinishResourceSetUp(self, resource, result, properties)

source code 

Finish setting up a resource.

'resource' -- The 'Resource' itself.

'result' -- The 'Result' associated with setting up the resource.

'properties' -- A dictionary of additional context properties that should be provided to tests that depend on this resource.

returns -- A tuple of the same form as is returned by '_BeginResourceSetUp' when the resource has already been set up.

Overrides: target.Target._FinishResourceSetUp
(inherited documentation)

_NoteIdleThread(self)

source code 

Note that the current thread.

This method is called by the thread when it has completed a task.

_Trace(self, message)

source code 

Write a trace 'message'.

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

_GetTemporaryDirectory(self)

source code 

Return the path to a temporary directory.

returns -- The path to a temporary directory to pass along to tests and resources via the 'TMPDIR_CONTEXT_PROPERTY'.

Overrides: target.Target._GetTemporaryDirectory
(inherited documentation)

Class Variable Details [hide private]

arguments

A list of the arguments to the extension class.

Each element of this list should be an instance of 'Field'. The 'Field' instance describes the argument.

Derived classes may redefine this class variable. However, derived classes should not explicitly include the arguments from base classes; QMTest will automatically combine all the arguments found throughout the class hierarchy.

Value:
[qm.fields.IntegerField(name= "threads", title= "Number of Threads", d\
escription= """The number of threads to devote to running tests.

            A positive integer that indicates the number of threads to
            use when running tests.  Larger numbers will allow more
            tests to be run at once.  You can experiment with this
            value to find the number that results in the fastest
            execution.""", default_value= 1),]