| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
GaudiTest.ReferenceFileValidator Class Reference

## Public Member Functions
def | __init__
def | __call__

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

## Detailed Description

Definition at line 572 of file GaudiTest.py.

## Constructor & Destructor Documentation

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

Definition at line 573 of file GaudiTest.py.

573
574 def __init__(self, reffile, cause, result_key, preproc = normalizeExamples):
575 self.reffile = os.path.expandvars(reffile)
576 self.cause = cause
577 self.result_key = result_key
self.preproc = preproc

## Member Function Documentation

def GaudiTest.ReferenceFileValidator.__call__ | ( |  | self,
|  |  | stdout,
|  |  | result
| ) |  |

Definition at line 578 of file GaudiTest.py.

578
579 def __call__(self, stdout, result):
580 causes = []
581 if os.path.isfile(self.reffile):
582 orig = open(self.reffile).xreadlines()
583 if self.preproc:
584 orig = self.preproc(orig)
585 else:
586 orig = []
587
588 new = stdout.splitlines()
589 if self.preproc:
590 new = self.preproc(new)
591 #open(self.reffile + ".test","w").writelines(new)
592 diffs = difflib.ndiff(orig,new,charjunk=difflib.IS_CHARACTER_JUNK)
593 filterdiffs = map(lambda x: x.strip(),filter(lambda x: x[0] != " ",diffs))
594 #filterdiffs = [x.strip() for x in diffs]
595 if filterdiffs:
596 result[self.result_key] = result.Quote("\n".join(filterdiffs))
597 result[self.result_key] += result.Quote("""
598 Legend:
599 -) reference file
600 +) standard output of the test""")
601 causes.append(self.cause)
602
603 return causes

## Member Data Documentation

GaudiTest.ReferenceFileValidator.cause

Definition at line 575 of file GaudiTest.py.

GaudiTest.ReferenceFileValidator.preproc

Definition at line 577 of file GaudiTest.py.

GaudiTest.ReferenceFileValidator.reffile

Definition at line 574 of file GaudiTest.py.

GaudiTest.ReferenceFileValidator.result_key

Definition at line 576 of file GaudiTest.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiPolicy/qmtest_classes/GaudiTest.py