| Home | Trees | Index | Help |
|---|
| Package qm :: Package test :: Module context :: Class Context |
|
object--+ |dict--+ | Context
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.
| Method Summary | |
|---|---|
Construct a new context. | |
__contains__(self,
key)
| |
__getitem__(self,
key)
| |
get(self,
key,
default)
| |
Return the properties added to this context by resources. | |
Return the boolean value associated with 'key'. | |
Return the value for 'variable' in scope 'klass'. | |
Return the list of strings associated with 'key'. | |
Return the path to the a temporary directory. | |
has_key(self,
key)
| |
items(self)
| |
Read the context file 'file_name'. | |
| Inherited from dict | |
x.__cmp__(y) <==> cmp(x,y) | |
x.__delitem__(y) <==> del x[y] | |
x.__eq__(y) <==> x==y | |
x.__ge__(y) <==> x>=y | |
x.__getattribute__('name') <==> x.name | |
x.__gt__(y) <==> x>y | |
x.__hash__() <==> hash(x) | |
x.__iter__() <==> iter(x) | |
x.__le__(y) <==> x<=y | |
x.__len__() <==> len(x) | |
x.__lt__(y) <==> x<y | |
x.__ne__(y) <==> x!=y | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
x.__repr__() <==> repr(x) | |
x.__setitem__(i, y) <==> x[i]=y | |
D.clear() -> None. | |
D.copy() -> a shallow copy of D | |
D.iteritems() -> an iterator over the (key, value) items of D | |
D.iterkeys() -> an iterator over the keys of D | |
D.itervalues() -> an iterator over the values of D | |
D.keys() -> list of D's keys | |
If key is not found, d is returned if given, otherwise KeyError is raised | |
2-tuple; but raise KeyError if D is empty | |
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D | |
D.update(E, **F) -> None. | |
D.values() -> list of D's values | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Inherited from type | |
v defaults to None. | |
| Class Variable Summary | |
|---|---|
int |
__safe_for_unpickling__ = 1 |
str |
DB_PATH_CONTEXT_PROPERTY = 'qmtest.dbpath'
|
str |
ID_CONTEXT_PROPERTY = 'qmtest.id'
|
str |
TARGET_CONTEXT_PROPERTY = 'qmtest.target'
|
str |
TMPDIR_CONTEXT_PROPERTY = 'qmtest.tmpdir'
|
| Method Details |
|---|
__init__(self,
context=None)
|
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(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. |
GetDerivedValue(self, klass, variable, default=None)Return the value for 'variable' in scope 'klass'. Scopes are nested with '.', and inner variables hide outer variables of the same name. Thus, looking up the value of 'a.b.c.var' will return 1 if the context contains a.b.c.var=1 but 2 if it contains a.b.d.var=1 a.b.var=2 a.var=3. 'klass' -- The variable's scope. 'variable' -- The variable name. 'default' -- Default value. |
GetStringList(self, key, default=None)Return the list of strings associated with 'key'. 'key' -- A string. 'default' -- A default list. 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 string list, an exception is raised. |
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(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'. |
| Class Variable Details |
|---|
__safe_for_unpickling__
|
DB_PATH_CONTEXT_PROPERTY
|
ID_CONTEXT_PROPERTY
|
TARGET_CONTEXT_PROPERTY
|
TMPDIR_CONTEXT_PROPERTY
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Sep 27 15:48:59 2007 | http://epydoc.sf.net |