Package qm :: Package test :: Module parameter_database :: Class ParameterDatabase
[hide private]
[frames] | no frames]

Class ParameterDatabase

source code

         object --+        
                  |        
extension.Extension --+    
                      |    
      database.Database --+
                          |
                         ParameterDatabase

A database that parametrizes another database. 'Parameter' in this context refers to any name that is used as a label, and which stands for a specific set of arguments passed to tests.

The 'ParameterDatabase' class is abstract. Subclasses need to implement the '_GetParametersForTest' as well as the '_GetArgumentsForParameter' method.

Nested Classes [hide private]
  ImplicitSuite
ImplicitSuite represents a suite obtained from a test and a set of parameters applied to it.
  WrapperSuite
As tests from the wrapped Database are mapped to suites, suites from the wrapped Database have to be recreated with all tests replaced by ImplicitSuite instances.
  ParameterSuite
ParameterSuite represents a suite obtained from applying a given parameter to a suite from the wrapped DB.

Inherited from extension.Extension: Type, __metaclass__

Instance Methods [hide private]
 
__init__(self, database, path, arguments)
Construct a 'Database'.
source code
 
GetWrappedDatabase(self) source code
 
_GetParametersForTest(self, test_id)
Return a list of parameters that can be applied to the test 'test_id'.
source code
 
_GetArgumentsForParameter(self, test_id, parameter)
Return the set of arguments for this parameter.
source code
 
GetTest(self, test_id)
Return the 'TestDescriptor' for the test named 'test_id'.
source code
 
HasTest(self, test_id)
Check whether or not the database has a test named 'test_id'.
source code
 
GetTestIds(self, directory='', scan_subdirs=1)
Return all test IDs that begin with 'directory'.
source code
 
GetSuite(self, suite_id)
Return the 'Suite' for the suite named 'suite_id'.
source code
 
HasSuite(self, suite_id)
Check whether or not the database has a suite named 'suite_id'.
source code
 
GetSuiteIds(self, directory='', scan_subdirs=1)
Return all suite IDs that begin with 'directory'.
source code
 
GetResource(self, resource_id)
Return the 'ResourceDescriptor' for the resource 'resouce_id'.
source code
 
HasResource(self, resource_id)
Check whether or not the database has a resource named 'resource_id'.
source code
 
GetResourceIds(self, directory='', scan_subdirs=1)
Return all resource IDs that begin with 'directory'.
source code
 
GetIds(self, kind, directory='', scan_subdirs=1)
Return all IDs of the indicated 'kind' that begin with 'directory'.
source code
 
GetSubdirectories(self, directory)
Return the immediate subdirectories of 'directory'.
source code
 
GetAttachmentStore(self)
Returns the 'AttachmentStore' associated with the database.
source code
 
GetClassPath(self) source code
 
GetTestClassNames(self)
Return the kinds of tests that the database can store.
source code
 
GetResourceClassNames(self)
Return the kinds of resources that the database can store.
source code

Inherited from database.Database: ExpandIds, GetClassPaths, GetConfigurationDirectory, GetExtension, GetExtensions, GetItem, GetLabelComponents, GetPath, IsModifiable, IsValidLabel, JoinLabels, RemoveExtension, SplitLabel, SplitLabelLeft, WriteExtension

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]
  _argument_list = [<<class 'qm.fields.TextField'> label_class>,...
A list of all the 'Field's in this class.

Inherited from database.Database: ITEM_KINDS, RESOURCE, SUITE, TEST, arguments, kind, label_class, modifiable

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, database, path, arguments)
(Constructor)

source code 

Construct a 'Database'.

'path' -- A string containing the absolute path to the directory containing the database.

'arguments' -- A dictionary mapping attribute names to values. The use of this parameter is deprecated. Use keyword arguments instead.

Derived classes must call this method from their own '__init__' methods. Every derived class must have an '__init__' method that takes the path to the directory containing the database as its only argument. The path provided to the derived class '__init__' function will always be an absolute path.

Overrides: object.__init__
(inherited documentation)

_GetArgumentsForParameter(self, test_id, parameter)

source code 

Return the set of arguments for this parameter.

'test_id' -- The test id to which the parameter belongs.

'parameter' -- The parameter for which the arguments are queried.

returns -- A dictionary containing the argument as name/value pairs.

GetTest(self, test_id)

source code 

Return the 'TestDescriptor' for the test named 'test_id'.

'test_id' -- A label naming the test.

returns -- A 'TestDescriptor' corresponding to 'test_id'.

raises -- 'NoSuchTestError' if there is no test in the database named 'test_id'.

Overrides: database.Database.GetTest
(inherited documentation)

HasTest(self, test_id)

source code 

Check whether or not the database has a test named 'test_id'.

'test_id' -- A label naming the test.

returns -- True if and only if the database contains a test named 'test_id'. If this function returns true, 'GetTest' will usually succeed. However, they may be circumstances where 'HasTest' returns true and 'GetTest' does not succeed. For example, someone might remove a critical file from the database between the time that 'HasTest' is called and the time that 'GetTest' is called.

Derived classes may override this method.

Overrides: database.Database.HasTest
(inherited documentation)

GetTestIds(self, directory='', scan_subdirs=1)

source code 

Return all test IDs that begin with 'directory'.

'directory' -- A label indicating the directory in which to begin the search.

'scan_subdirs' -- True if (and only if) subdirectories of 'directory' should be scanned.

'returns' -- A list of all tests located within 'directory', as absolute labels.

Overrides: database.Database.GetTestIds
(inherited documentation)

GetSuite(self, suite_id)

source code 

Return the 'Suite' for the suite named 'suite_id'.

'suite_id' -- A label naming the suite.

returns -- An instance of 'Suite' (or a derived class of 'Suite') corresponding to 'suite_id'.

raises -- 'NoSuchSuiteError' if there is no test in the database named 'test_id'.

All databases must have an implicit suite called '' that contains all tests in the database. More generally, for each directory in the database, there must be a corresponding suite that contains all tests in that directory and its subdirectories.

Overrides: database.Database.GetSuite
(inherited documentation)

HasSuite(self, suite_id)

source code 

Check whether or not the database has a suite named 'suite_id'.

'suite_id' -- A label naming the suite.

returns -- True if and only if the database contains a suite named 'suite_id'. If this function returns true, 'GetSuite' will usually succeed. However, they may be circumstances where 'HasSuite' returns true and 'GetSuite' does not succeed. For example, someone might remove a critical file from the database between the time that 'HasSuite' is called and the time that 'GetSuite' is called.

All databases must have an implicit suite called "" that contains all tests in the database. More generally, for each directory in the database, there must be a corresponding suite that contains all tests in that directory and its subdirectories.

Derived classes may override this method.

Overrides: database.Database.HasSuite
(inherited documentation)

GetSuiteIds(self, directory='', scan_subdirs=1)

source code 

Return all suite IDs that begin with 'directory'.

'directory' -- A label indicating the directory in which to begin the search.

'scan_subdirs' -- True if (and only if) subdirectories of 'directory' should be scanned.

'returns' -- A list of all suites located within 'directory', as absolute labels.

Overrides: database.Database.GetSuiteIds
(inherited documentation)

GetResource(self, resource_id)

source code 

Return the 'ResourceDescriptor' for the resource 'resouce_id'.

'resource_id' -- A label naming the resource.

returns -- A 'ResourceDescriptor' corresponding to 'resource_id'.

raises -- 'NoSuchResourceError' if there is no resource in the database named 'resource_id'.

Overrides: database.Database.GetResource
(inherited documentation)

HasResource(self, resource_id)

source code 

Check whether or not the database has a resource named 'resource_id'.

'resource_id' -- A label naming the resource.

returns -- True if and only if the database contains a resource named 'resource_id'. If this function returns true, 'GetResource' will usually succeed. However, they may be circumstances where 'HasResource' returns true and 'GetResource' does not succeed. For example, someone might remove a critical file from the database between the time that 'HasResource' is called and the time that 'GetResource' is called.

Derived classes may override this method.

Overrides: database.Database.HasResource
(inherited documentation)

GetResourceIds(self, directory='', scan_subdirs=1)

source code 

Return all resource IDs that begin with 'directory'.

'directory' -- A label indicating the directory in which to begin the search.

'scan_subdirs' -- True if (and only if) subdirectories of 'directory' should be scanned.

'returns' -- A list of all resources located within 'directory', as absolute labels.

Overrides: database.Database.GetResourceIds
(inherited documentation)

GetIds(self, kind, directory='', scan_subdirs=1)

source code 

Return all IDs of the indicated 'kind' that begin with 'directory'.

'kind' -- One of the 'ITEM_KINDS'.

'directory' -- A label indicating the directory in which to begin the search.

'scan_subdirs' -- True if (and only if) subdirectories of 'directory' should be scanned.

returns -- A list of all items of the indicated 'kind' located within 'directory', as absolute labels.

Derived classes may override this method.

Overrides: database.Database.GetIds
(inherited documentation)

GetSubdirectories(self, directory)

source code 

Return the immediate subdirectories of 'directory'.

'directory' -- A label indicating a directory in the database.

returns -- A sequence of (relative) labels indictating the immediate subdirectories of 'directory'. For example, if "a.b" and "a.c" are directories in the database, this method will return "b" and "c" given "a" as 'directory'.

Derived classes may override this method.

Overrides: database.Database.GetSubdirectories
(inherited documentation)

GetAttachmentStore(self)

source code 

Returns the 'AttachmentStore' associated with the database.

returns -- The 'AttachmentStore' containing the attachments associated with tests and resources in this database.

Derived classes may override this method.

Overrides: database.Database.GetAttachmentStore
(inherited documentation)

GetTestClassNames(self)

source code 

Return the kinds of tests that the database can store.

returns -- A sequence of strings. Each string names a class, including the containing module. Only classes of these types can be stored in the database.

Derived classes may override this method. The default implementation allows all available test classes, but the derived class may allow only a subset.

Overrides: database.Database.GetTestClassNames
(inherited documentation)

GetResourceClassNames(self)

source code 

Return the kinds of resources that the database can store.

returns -- A sequence of strings. Each string names a class, including the containing module. Only resources of these types can be stored in the database.

Derived classes may override this method. The default implementation allows all available resource classes, but the derived class may allow only a subset.

Overrides: database.Database.GetResourceClassNames
(inherited documentation)

Class Variable Details [hide private]

_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.TextField'> label_class>,
 <<class 'qm.fields.BooleanField'> modifiable>]