Package qm :: Package test :: Module result_stream :: Class ResultStream
[hide private]
[frames] | no frames]

Class ResultStream
source code

         object --+    
                  |    
extension.Extension --+
                      |
                     ResultStream
Known Subclasses:
file_result_stream.FileResultStream, web.web.StorageResultsStream, classes.sql_result_stream.SQLResultStream

A 'ResultStream' displays test results.

A 'ResultStream' is responsible for displaying test results for the user as they arrive. It may also display summary information when the results are complete. The 'ResultStream' may also choose to write the results to a file for permanent storage.

'ResultStream' is an abstract class.

Nested Classes [hide private]

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  Summarize(self)
Output summary information about the results.
  WriteAllAnnotations(self, annotations)
Output all annotations in 'annotations' to this stream.
  WriteAnnotation(self, key, value)
Output an annotation for this run.
  WriteResult(self, result)
Output a test result.
  _GetExpectedOutcome(self, test_id)
Return the outcome expected for 'test_id'.
  __init__(self, arguments=None, **args)
Construct a new 'Extension'.

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 A map from argument names to 'Field' instances.
_argument_list A list of all the 'Field's in this class.
expected_outcomes  
kind A string giving kind of extension is implemented by the class.

Inherited from extension.Extension: arguments

Inherited from object: __class__


Method Details [hide private]

Summarize(self)

source code 

Output summary information about the results.

When this method is called, the test run is complete. Summary information should be displayed for the user, if appropriate. Any finalization, such as the closing of open files, should also be performed at this point.

Derived class methods may override this method. They should, however, invoke this version before returning.

WriteAllAnnotations(self, annotations)

source code 

Output all annotations in 'annotations' to this stream.

Currently this is the same as making repeated calls to 'WriteAnnotation', but in the future, as special annotation types like timestamps are added, this will do the work of dispatching to functions like 'WriteTimestamp'.

Should not be overridden by subclasses.

WriteAnnotation(self, key, value)

source code 

Output an annotation for this run.

Subclasses should override this if they want to store/display annotations; the default implementation simply discards them.

'key' -- the key value as a string.

'value' -- the value of this annotation as a string.

WriteResult(self, result)

source code 

Output a test result.

Subclasses must override this method; the default implementation raises a 'NotImplementedError'.

'result' -- A 'Result'.

_GetExpectedOutcome(self, test_id)

source code 

Return the outcome expected for 'test_id'.

returns -- The outcome (one of the elements of 'Result.outcomes') expected for 'test_id'. The expected outcome is taken from the 'expected_outcomes' provided when constructing this result stream, if available. If no expected outcome is available the default value ('Result.PASS') will be returned.

__init__(self, arguments=None, **args)
(Constructor)

source code 

Construct a new 'Extension'.

'args': Keyword arguments providing values for Extension parameters. The values should be appropriate for the corresponding fields. Derived classes must pass along any unrecognized keyword arguments to this method so that additional arguments can be added in the future without necessitating changes to derived classes.

This method will place all of the arguments into this objects instance dictionary.

Derived classes may override this method, but should call this method during their processing.
Overrides: extension.Extension.__init__
(inherited documentation)

Class Variable Details [hide private]

_argument_dictionary

A map from argument names to 'Field' instances.

A map from the names of arguments for this class to the corresponding 'Field'.
Value:
{'expected_outcomes': <<class 'qm.fields.PythonField'> expected_outcom\
es>}                                                                   
      

_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.PythonField'> expected_outcomes>]                  
      

expected_outcomes

Value:
{}                                                                     
      

kind

A string giving kind of extension is implemented by the class.

This field is used in an application-specific way; for example, QMTest has 'test' and 'target' extension classes.
Value:
'result_stream'