An ItemDescriptor describes a test, resource, or similar entity.
Some Database operations return an instance of a class derived
from ItemDescriptor , rather than the object described. For
example, Database.GetTest returns a TestDescriptor , not a
Test . This additional indirection is an optimization; the
creation of the actual Test object may be relatively expensive,
and in many cases all that is needed is information that can be
gleaned from the descriptor.
Methods
|
|
|
|
GetArguments
|
GetArguments ( self )
Return the entity arguments.
- returns
- A dictionary mapping argument names to argument
values. These arguments will be provided to the extension class
when the entity is constructed.
|
|
GetClass
|
GetClass ( self )
Return the class of the entity.
- returns
- The Python class object for the entity. For example,
for a
TestDescriptor , this method returns the test class.
|
|
GetClassArguments
|
GetClassArguments ( self )
Return the arguments specified by the test class.
- returns
- A list of
Field objects containing all the
arguments in the class hierarchy.
Derived classes should not override this method.
|
|
GetClassName
|
GetClassName ( self )
Return the class name of the entity.
- returns
- The name of the extension class for the entity. For
example, for a
TestDescriptor , this method returns the name of
the test class.
|
|
GetDatabase
|
GetDatabase ( self )
Return the Database containing this entity.
- returns
- The
Database object in which this entity is
located.
|
|
GetId
|
GetId ( self )
Return the label for this entity.
- returns
- The label for this entity.
|
|
GetItem
|
GetItem ( self )
Return the entity.
- returns
- An instance of the class returned by
GetClass .
|
|
GetResources
|
GetResources ( self )
Return the resources required by this item.
- returns
- A sequence of resource names. Each name indicates a
resource that must be available to this item.
|
|
_Execute
|
_Execute (
self,
context,
result,
method,
)
Execute the entity.
-
context
- The
Context in which the test should be executed,
or None if the method does not take a Context argument.
-
result
- The
Result object corresponding to this execution.
-
method
- The method name of the method on the entity that
should be invoked to perform the execution.
|
|
__init__
|
__init__ (
self,
database,
instance_id,
class_name,
arguments,
)
Construct an ItemDescriptor .
-
database
- The
Database object in which this entity is
located.
-
instance_id
- The label for this entity.
-
class_name
- The name of the extension class for the entity.
For example, for a
TestDescriptor , the class_name is the
name of the test class.
-
arguments
- A dictionary mapping argument names to argument
values. These arguments will be provided to the extension class
when the entity is constructed.
|
|