The Gaudi Framework  v33r1 (b1225454)
GaudiTest.BasicOutputValidator Class Reference

Output Validation Classes. More...

Public Member Functions

def __init__ (self, ref, cause, result_key)
 
def __call__ (self, out, result)
 

Public Attributes

 reference
 
 cause
 
 result_key
 

Private Member Functions

def __CompareText (self, s1, s2)
 

Detailed Description

Output Validation Classes.

Basic implementation of an option validator for Gaudi tests.
This implementation is based on the standard (LCG) validation functions
used in QMTest.

Definition at line 393 of file GaudiTest.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiTest.BasicOutputValidator.__init__ (   self,
  ref,
  cause,
  result_key 
)

Definition at line 399 of file GaudiTest.py.

399  def __init__(self, ref, cause, result_key):
400  self.reference = ref
401  self.cause = cause
402  self.result_key = result_key
403 

Member Function Documentation

◆ __call__()

def GaudiTest.BasicOutputValidator.__call__ (   self,
  out,
  result 
)
Validate the output of the program.

'stdout' -- A string containing the data written to the standard output
stream.

'stderr' -- A string containing the data written to the standard error
stream.

'result' -- A 'Result' object. It may be used to annotate
the outcome according to the content of stderr.

returns -- A list of strings giving causes of failure.

Definition at line 404 of file GaudiTest.py.

404  def __call__(self, out, result):
405  """Validate the output of the program.
406 
407  'stdout' -- A string containing the data written to the standard output
408  stream.
409 
410  'stderr' -- A string containing the data written to the standard error
411  stream.
412 
413  'result' -- A 'Result' object. It may be used to annotate
414  the outcome according to the content of stderr.
415 
416  returns -- A list of strings giving causes of failure."""
417 
418  causes = []
419  # Check to see if theoutput matches.
420  if not self.__CompareText(out, self.reference):
421  causes.append(self.cause)
422  result[self.result_key] = result.Quote(self.reference)
423 
424  return causes
425 

◆ __CompareText()

def GaudiTest.BasicOutputValidator.__CompareText (   self,
  s1,
  s2 
)
private
Compare 's1' and 's2', ignoring line endings.

's1' -- A string.

's2' -- A string.

returns -- True if 's1' and 's2' are the same, ignoring
differences in line endings.

Definition at line 426 of file GaudiTest.py.

426  def __CompareText(self, s1, s2):
427  """Compare 's1' and 's2', ignoring line endings.
428 
429  's1' -- A string.
430 
431  's2' -- A string.
432 
433  returns -- True if 's1' and 's2' are the same, ignoring
434  differences in line endings."""
435 
436  # The "splitlines" method works independently of the line ending
437  # convention in use.
438  if ROOT6WorkAroundEnabled('ReadRootmapCheck'):
439  # FIXME: (MCl) Hide warnings from new rootmap sanity check until we can fix them
440  to_ignore = re.compile(
441  r'Warning in <TInterpreter::ReadRootmapFile>: .* is already in .*'
442  )
443 
444  def keep_line(l):
445  return not to_ignore.match(l)
446 
447  return filter(keep_line, s1.splitlines()) == filter(
448  keep_line, s2.splitlines())
449  else:
450  return s1.splitlines() == s2.splitlines()
451 
452 
def ROOT6WorkAroundEnabled(id=None)
Definition: GaudiTest.py:37

Member Data Documentation

◆ cause

GaudiTest.BasicOutputValidator.cause

Definition at line 401 of file GaudiTest.py.

◆ reference

GaudiTest.BasicOutputValidator.reference

Definition at line 400 of file GaudiTest.py.

◆ result_key

GaudiTest.BasicOutputValidator.result_key

Definition at line 402 of file GaudiTest.py.


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