Package qm :: Package test :: Module file_database :: Class ExtensionDatabase
[hide private]
[frames] | no frames]

Class ExtensionDatabase
source code

         object --+            
                  |            
extension.Extension --+        
                      |        
      database.Database --+    
                          |    
               FileDatabase --+
                              |
                             ExtensionDatabase
Known Subclasses:
classes.xml_database.XMLDatabase

An 'ExtensionDatabase' is a 'FileDatabase' where each kind of entity (test, suite, resource) has a particular extension. For example, if tests have the extension '.qmt', then all files ending with '.qmt' are considered tests. If an extension for a particular kind of entity is not specified or is the empty string, then all files will be considered to be that kind of entity.

'ExtensionDatabase' is an abstract class.

Nested Classes [hide private]

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  GetResourceExtension(self)
Return the extension that indicates a file is a resource.
  GetResourcePath(self, resource_id)
Return the file containing 'resource_id'.
  GetSuiteExtension(self)
Return the extension that indicates a file is a suite.
  GetSuitePath(self, suite_id)
Return the file containing 'suite_id'.
  GetTestExtension(self)
Return the extension that indicates a file is a test.
  GetTestPath(self, test_id)
Return the file containing 'test_id'.
  _GetLabelFromBasename(self, basename)
Returns the label associated with a file named 'basename'.
  _GetPathFromLabel(self, label)
Returns the file system path corresponding to 'label'.
  _GetRelativeLabelPath(self, label)
Returns a representation of 'label' as a filename.
  _IsResourceFile(self, path)
Returns true if 'path' is a resource file.
  _IsSuiteFile(self, path)
Returns true if 'path' is a test suite file or directory.
  _IsTestFile(self, path)
Returns true if 'path' is a test file.
  __init__(self, path, arguments=None, **args)
Construct a 'Database'.

Inherited from FileDatabase: GetIds, GetResource, GetRoot, GetSubdirectories, GetSuite, GetTest, RemoveExtension

Inherited from database.Database: ExpandIds, GetAttachmentStore, GetClassPaths, GetConfigurationDirectory, GetExtension, GetExtensions, GetItem, GetLabelComponents, GetPath, GetResourceClassNames, GetResourceIds, GetSuiteIds, GetTestClassNames, GetTestIds, HasResource, HasSuite, HasTest, IsModifiable, IsValidLabel, JoinLabels, SplitLabel, SplitLabelLeft, WriteExtension

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]
_argument_dictionary  
_argument_list  
arguments  
resource_extension  
suite_extension  
test_extension  

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

Inherited from object: __class__


Method Details [hide private]

GetResourceExtension(self)

source code 

Return the extension that indicates a file is a resource.

returns -- The extension (including the leading period) that indicates that a file is a resource.

GetResourcePath(self, resource_id)

source code 

Return the file containing 'resource_id'.

'resource_id' -- The name of a resource.

returns -- The absolute file name of the file that contains, or would contain, 'resource_id'. This method works even if no Resource named 'resource_id' exists.

Derived classes may override this method.
Overrides: FileDatabase.GetResourcePath
(inherited documentation)

GetSuiteExtension(self)

source code 

Return the extension that indicates a file is a suite.

returns -- The extension (including the leading period) that indicates that a file is a suite.

GetSuitePath(self, suite_id)

source code 

Return the file containing 'suite_id'.

'suite_id' -- The name of a suite.

returns -- The absolute file name of the file (or directory) that contains, or would contain, 'suite_id'. This method works even if no suite named 'suite_id' exists.

Derived classes may override this method.
Overrides: FileDatabase.GetSuitePath
(inherited documentation)

GetTestExtension(self)

source code 

Return the extension that indicates a file is a test.

returns -- The extension (including the leading period) that indicates that a file is a test.

GetTestPath(self, test_id)

source code 

Return the file containing 'test_id'.

'test_id' -- The name of a test.

returns -- The absolute file name of the file that contains, or would contain, 'test_id'. This method works even if no test named 'test_id' exists.

Derived classes may override this method.
Overrides: FileDatabase.GetTestPath
(inherited documentation)

_GetLabelFromBasename(self, basename)

source code 

Returns the label associated with a file named 'basename'.

'basename' -- The basename of a file, including the extension.

returns -- The corresponding label.

Derived classes may override this method.
Overrides: FileDatabase._GetLabelFromBasename
(inherited documentation)

_GetPathFromLabel(self, label)

source code 

Returns the file system path corresponding to 'label'.

'label' -- The id for a test, test suite, or similar entity.

returns -- The absolute path for the corresponding entry in the file system, but without any required extension.
Overrides: FileDatabase._GetPathFromLabel
(inherited documentation)

_GetRelativeLabelPath(self, label)

source code 

Returns a representation of 'label' as a filename.

returns -- A filename corresponding to 'label'.
Overrides: FileDatabase._GetRelativeLabelPath

_IsResourceFile(self, path)

source code 

Returns true if 'path' is a resource file.

'path' -- The absolute name of a file. All relevant components in the path name have already been checked to ensure that they are valid labels.

returns -- True iff the file corresponds to a resource.

Derived classes must override this method.
Overrides: FileDatabase._IsResourceFile
(inherited documentation)

_IsSuiteFile(self, path)

source code 

Returns true if 'path' is a test suite file or directory.

'path' -- The absolute name of a file. All relevant components in the path name have already been checked to ensure that they are valid labels.

returns -- True iff the file corresponds to a test.

Derived classes may override this method, but only to restrict the set of suites. In particular, a derived class method may return false where this method would return true, but never vice versa.

Derived classes must override this method.
Overrides: FileDatabase._IsSuiteFile
(inherited documentation)

_IsTestFile(self, path)

source code 

Returns true if 'path' is a test file.

'path' -- The absolute name of a file. All relevant components in the path name have already been checked to ensure that they are valid labels.

returns -- True iff the file corresponds to a test.

Derived classes must override this method.
Overrides: FileDatabase._IsTestFile
(inherited documentation)

__init__(self, path, arguments=None, **args)
(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: database.Database.__init__
(inherited documentation)

Class Variable Details [hide private]

_argument_dictionary

Value:
{'label_class': <<class 'qm.fields.TextField'> label_class>,
 'modifiable': <<class 'qm.fields.BooleanField'> modifiable>,
 'resource_extension': <<class 'qm.fields.TextField'> resource_extensi\
on>,
 'suite_extension': <<class 'qm.fields.TextField'> suite_extension>,
 'test_extension': <<class 'qm.fields.TextField'> test_extension>}     
      

_argument_list

Value:
[<<class 'qm.fields.TextField'> resource_extension>,
 <<class 'qm.fields.BooleanField'> modifiable>,
 <<class 'qm.fields.TextField'> test_extension>,
 <<class 'qm.fields.TextField'> label_class>,
 <<class 'qm.fields.TextField'> suite_extension>]                      
      

arguments

Value:
[<<class 'qm.fields.TextField'> test_extension>,
 <<class 'qm.fields.TextField'> suite_extension>,
 <<class 'qm.fields.TextField'> resource_extension>]                   
      

resource_extension

Value:
'.qma'                                                                 
      

suite_extension

Value:
'.qms'                                                                 
      

test_extension

Value:
'.qmt'