Table of Contents

Class: Context qm/test/context.py

Test-time and local configuration for tests.

A Context object contains all of the information a test needs to execute, beyond what is stored as part of the test specification itself. Information in the context can include,

  • Local (per-user, etc.) configuration, such as where to find the tested program.

  • Environmental information, such as which machine the test is running on.

  • One-time configuration, including test arguments specified on the command line.

A Context object is effectively a mapping object whose keys must be labels and values must be strings.

Base Classes   
types.DictType
Methods   
GetAddedProperties
GetBoolean
GetTemporaryDirectory
Read
__contains__
__getitem__
__init__
get
has_key
items
  GetAddedProperties 
GetAddedProperties ( self )

Return the properties added to this context by resources.

returns
A map from strings to values indicating properties that were added to this context by resources.
  GetBoolean 
GetBoolean (
        self,
        key,
        default=None,
        )

Return the boolean value associated with key.

key
A string.
default
A default boolean value.
returns
The value associated with key in the context, interpreted as a boolean.

If there is no value associated with key and default is not None, then the boolean value associated with default is used. If there is no value associated with key and default is None, an exception is raised.

The value associated with key must be a string. If not, an exception is raised. If the value is a string, but does not correspond to a boolean value, an exception is raised.

Exceptions   
ContextException( key )
ContextException( key, "invalid boolean context var" )
  GetTemporaryDirectory 
GetTemporaryDirectory ( self )

Return the path to the a temporary directory.

returns
The path to the a temporary directory. The Runnable object may make free use of this temporary directory; no other 'Runnable's will use the same directory at the same time.
  Read 
Read ( self,  file_name )

Read the context file file_name.

file_name
The name of the context file.

Reads the context file and adds the context properties in the file to self.

Exceptions   
qm.cmdline.CommandError, msg
qm.cmdline.CommandError, qm.error( "could not read file", path = file_name )
  __contains__ 
__contains__ ( self,  key )

  __getitem__ 
__getitem__ ( self,  key )

Exceptions   
ContextException( key )
  __init__ 
__init__ ( self,  context=None )

Construct a new context.

context
If not None, the existing Context being wrapped by this new context.
  get 
get (
        self,
        key,
        default=None,
        )

  has_key 
has_key ( self,  key )

  items 
items ( self )


Table of Contents

This document was automatically generated on Mon Jan 3 09:42:29 2005 by HappyDoc version 2.1