| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | List of all members
GaudiTesting.BaseTest.ReferenceFileValidator Class Reference

## Public Member Functions
def | __init__ (self, reffile, cause, result_key, preproc=normalizeExamples)
def | __call__ (self, stdout, result)

## Public Attributes
| reffile
| cause
| result_key
| preproc

## Detailed Description

Definition at line 1028 of file BaseTest.py.

## Constructor & Destructor Documentation

## ◆ __init__()

def GaudiTesting.BaseTest.ReferenceFileValidator.__init__ | ( |  | self,
|  |  | reffile,
|  |  | cause,
|  |  | result_key,
|  |  | preproc = `normalizeExamples`
| ) |  |

Definition at line 1029 of file BaseTest.py.

1029 def __init__(self, reffile, cause, result_key, preproc=normalizeExamples):
1030 self.reffile = os.path.expandvars(reffile)
1031 self.cause = cause
1032 self.result_key = result_key
1033 self.preproc = preproc
1034

## Member Function Documentation

## ◆ __call__()

def GaudiTesting.BaseTest.ReferenceFileValidator.__call__ | ( |  | self,
|  |  | stdout,
|  |  | result
| ) |  |

Definition at line 1035 of file BaseTest.py.

1035 def __call__(self, stdout, result):
1036 causes = []
1037 if os.path.isfile(self.reffile):
1038 orig = open(self.reffile).xreadlines()
1039 if self.preproc:
1040 orig = self.preproc(orig)
1041 result[self.result_key + '.preproc.orig'] = \
1042 result.Quote('\n'.join(map(str.strip, orig)))
1043 else:
1044 orig = []
1045 new = stdout.splitlines()
1046 if self.preproc:
1047 new = self.preproc(new)
1048
1049 diffs = difflib.ndiff(orig, new, charjunk=difflib.IS_CHARACTER_JUNK)
1050 filterdiffs = map(lambda x: x.strip(),
1051 filter(lambda x: x[0] != " ", diffs))
1052 if filterdiffs:
1053 result[self.result_key] = result.Quote("\n".join(filterdiffs))
1054 result[self.result_key] += result.Quote("""
1055 Legend:
1056 -) reference file
1057 +) standard output of the test""")
1058 result[self.result_key + '.preproc.new'] = \
1059 result.Quote('\n'.join(map(str.strip, new)))
1060 causes.append(self.cause)
1061 return causes
1062
1063
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:25

## Member Data Documentation

## ◆ cause

GaudiTesting.BaseTest.ReferenceFileValidator.cause

Definition at line 1031 of file BaseTest.py.

## ◆ preproc

GaudiTesting.BaseTest.ReferenceFileValidator.preproc

Definition at line 1033 of file BaseTest.py.

## ◆ reffile

GaudiTesting.BaseTest.ReferenceFileValidator.reffile

Definition at line 1030 of file BaseTest.py.

## ◆ result_key

GaudiTesting.BaseTest.ReferenceFileValidator.result_key

Definition at line 1032 of file BaseTest.py.

The documentation for this class was generated from the following file:

- GaudiPolicy/python/GaudiTesting/BaseTest.py