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'.
  IsIdle(self)
Return true if the target is idle.
  Start(self, response_queue, engine=None)
Start the target.
  Stop(self)
Stop the target.
  RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
  _RunTest(self, descriptor, context)
Run the test given by 'descriptor'.
  _RecordResult(self, result)
Record the 'result'.
  _BeginResourceSetUp(self, resource_name)
Begin setting up the indicated resource.
  _FinishResourceSetUp(self, resource, result, properties)
Finish setting up a resource.
  _NoteIdleThread(self)
Note that the current thread.
  _Trace(self, message)
Write a trace 'message'.
  _GetTemporaryDirectory(self)
Return the path to a temporary directory.

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__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
arguments A list of the arguments to the extension class.
_argument_dictionary A map from argument names to 'Field' instances.
_argument_list A list of all the 'Field's in this class.
threads  

Inherited from target.Target: group, kind, name

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: target.Target.__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:
[<<class 'qm.fields.IntegerField'> threads>]                           
      

_argument_dictionary

A map from argument names to 'Field' instances.

A map from the names of arguments for this class to the corresponding 'Field'.
Value:
{'group': <<class 'qm.fields.TextField'> group>,
 'name': <<class 'qm.fields.TextField'> name>,
 'threads': <<class 'qm.fields.IntegerField'> threads>}                
      

_argument_list

A list of all the 'Field's in this class.

This list combines the complete list of 'arguments'. 'Field's appear in the order reached by a pre-order breadth-first traversal of the hierarchy, starting from the most derived class.
Value:
[<<class 'qm.fields.IntegerField'> threads>,
 <<class 'qm.fields.TextField'> group>,
 <<class 'qm.fields.TextField'> name>]                                 
      

threads

Value:
1