Package qm :: Package test :: Module base
[hide private]
[frames] | no frames]

Module base

source code

Classes [hide private]
  CouldNotLoadExtensionError
An exception indicating that an extension class could not be loaded.
Functions [hide private]
 
get_extension_directories(kind, database, database_path=None)
Return the directories to search for QMTest extensions.
source code
 
get_extension_class_names_in_directory(directory)
Return the names of QMTest extension classes in 'directory'.
source code
 
get_extension_class_names(kind, database, database_path=None)
Return the names of extension classes.
source code
 
get_extension_class_from_directory(class_name, kind, directory, path)
Load an extension class from 'directory'.
source code
 
get_extension_class(class_name, kind, database, database_path=None)
Return the extension class named 'class_name'.
source code
 
get_test_class(class_name, database)
Return the test class named 'class_name'.
source code
 
get_resource_class(class_name, database)
Return the resource class named 'class_name'.
source code
 
get_extension_classes(kind, database=None)
Return the extension classes for the given 'kind'.
source code
 
load_results(file, database)
Read test results from a file.
source code
 
load_expectations(file, database, annotations=None)
Read expectations from a file.
source code
 
load_outcomes(file, database)
Load test outcomes from a file.
source code
 
_result_from_dom(node)
Extract a result from a DOM node.
source code
Variables [hide private]
  __extension_bases = {'database': qm.test.database.Database, 'h...
A map from extension class kinds to base classes.
  extension_kinds = __extension_bases.keys()
Names of different kinds of QMTest extension classes.
  __class_caches = {}
A dictionary of loaded class caches.
Function Details [hide private]

get_extension_directories(kind, database, database_path=None)

source code 
Return the directories to search for QMTest extensions.

'kind' -- A string giving kind of extension for which we are looking.
This must be of the elements of 'extension_kinds'.

'database' -- The 'Database' with which the extension class will be
used, or 'None'.

'database_path' -- The path from which the database will be loaded.
If 'None', 'database.GetPath()' is used.

returns -- A sequence of strings.  Each string is the path to a
directory that should be searched for QMTest extensions.  The
directories must be searched in order; the first directory
containing the desired module is the one from which the module is
loaded.

The directories that are returned are, in order:

1. Those directories present in the 'QMTEST_CLASS_PATH' environment
   variable.

2. Those directories specified by the 'GetClassPaths' method on the
   test database -- unless 'kind' is 'database'.

3. The directory specified by config.extension_path.

4. The directories containing classes that come with QMTest.

By placing the 'QMTEST_CLASS_PATH' directories first, users can
override test classes with standard names.

get_extension_class_names_in_directory(directory)

source code 

Return the names of QMTest extension classes in 'directory'.

'directory' -- A string giving the path to a directory in the file system.

returns -- A dictionary mapping the strings in 'extension_kinds' to sequences of strings. Each element in the sequence names an extension class, using the form 'module.class'

get_extension_class_names(kind, database, database_path=None)

source code 

Return the names of extension classes.

'kind' -- The kind of extension class. This value must be one of the 'extension_kinds'.

'database' -- The 'Database' with which the extension class will be used, or 'None' if 'kind' is 'database'.

'database_path' -- The path from which the database will be loaded. If 'None', 'database.GetPath()' is used.

returns -- A sequence of strings giving the names of the extension classes with the indicated 'kind', in the form 'module.class'.

get_extension_class_from_directory(class_name, kind, directory, path)

source code 

Load an extension class from 'directory'.

'class_name' -- The name of the extension class, in the form 'module.class'.

'kind' -- The kind of class to load. This value must be one of the 'extension_kinds'.

'directory' -- The directory from which to load the class.

'path' -- The directories to search for modules imported by the new module.

returns -- The class loaded.

get_extension_class(class_name, kind, database, database_path=None)

source code 

Return the extension class named 'class_name'.

'class_name' -- The name of the class, in the form 'module.class'.

'kind' -- The kind of class to load. This value must be one of the 'extension_kinds'.

'database' -- The 'Database' with which the extension class will be used, or 'None' if 'kind' is 'database'.

'database_path' -- The path from which the database will be loaded. If 'None', 'database.GetPath()' is used.

returns -- The class object with the indicated 'class_name'.

get_test_class(class_name, database)

source code 

Return the test class named 'class_name'.

'class_name' -- The name of the test class, in the form 'module.class'.

returns -- The test class object with the indicated 'class_name'.

get_resource_class(class_name, database)

source code 

Return the resource class named 'class_name'.

'class_name' -- The name of the resource class, in the form 'module.class'.

returns -- The resource class object with the indicated 'class_name'.

get_extension_classes(kind, database=None)

source code 

Return the extension classes for the given 'kind'.

'kind' -- The kind of extensions being sought. The value must be one of the 'extension_kinds'.

'database' -- If not 'None', the test 'Database' in use.

returns -- A list of the available extension classes of the indicated 'kind'.

load_results(file, database)

source code 

Read test results from a file.

'file' -- The filename or file object from which to read the results. If 'file' is not a string, then it is must be a seekable file object, and this function will look for a 'FileResultReader' that accepts the file. If 'file' is a string, then it is treated as either a filename or as an extension descriptor.

'database' -- The current database.

returns -- A 'ResultReader' object, or raises an exception if no appropriate reader is available.

load_expectations(file, database, annotations=None)

source code 

Read expectations from a file.

'file' -- The filename or file object from which to read the expectations. If 'file' is not a string, then it is must be a seekable file object, and this function will look for an 'ExpectationDatabase' that accepts the file. If 'file' is a string, then it is treated as either a filename or as an extension descriptor.

'database' -- The current database.

'annotations' -- Annotations for the current test run.

returns -- An 'ExpectationDatabase' object, or raises an exception if no appropriate reader is available.

load_outcomes(file, database)

source code 

Load test outcomes from a file.

'file' -- The file object from which to read the results. See 'load_results' for details.

'database' -- The current database.

returns -- A map from test IDs to outcomes.

_result_from_dom(node)

source code 

Extract a result from a DOM node.

'node' -- A DOM node corresponding to a "result" element.

returns -- A 'Result' object. The context for the result is 'None', since context is not represented in a result DOM node.


Variables Details [hide private]

__extension_bases

A map from extension class kinds to base classes.

An extension class of a particular 'kind' must be derived from 'extension_bases[kind]'.

Value:
{'database': qm.test.database.Database, 'host': qm.host.Host, 'label':\
 qm.label.Label, 'resource': qm.test.resource.Resource, 'result_reader\
': qm.test.result_reader.ResultReader, 'result_stream': qm.test.result\
_stream.ResultStream, 'run_database': qm.test.run_database.RunDatabase\
, 'expectation_database': qm.test.expectation_database.ExpectationData\
base, 'suite': qm.test.suite.Suite, 'target': qm.test.target.Target, '\
test': qm.test.test.Test}

__class_caches

A dictionary of loaded class caches.

The keys are the kinds in 'extension_kinds'. The associated value is itself a dictionary mapping class names to class objects.

Value:
{}