The Gaudi Framework  v32r2 (46d42edc)
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 383 of file GaudiTest.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 389 of file GaudiTest.py.

389  def __init__(self, ref, cause, result_key):
390  self.reference = ref
391  self.cause = cause
392  self.result_key = result_key
393 

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 394 of file GaudiTest.py.

394  def __call__(self, out, result):
395  """Validate the output of the program.
396 
397  'stdout' -- A string containing the data written to the standard output
398  stream.
399 
400  'stderr' -- A string containing the data written to the standard error
401  stream.
402 
403  'result' -- A 'Result' object. It may be used to annotate
404  the outcome according to the content of stderr.
405 
406  returns -- A list of strings giving causes of failure."""
407 
408  causes = []
409  # Check to see if theoutput matches.
410  if not self.__CompareText(out, self.reference):
411  causes.append(self.cause)
412  result[self.result_key] = result.Quote(self.reference)
413 
414  return causes
415 

◆ __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 416 of file GaudiTest.py.

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

Member Data Documentation

◆ cause

GaudiTest.BasicOutputValidator.cause

Definition at line 391 of file GaudiTest.py.

◆ reference

GaudiTest.BasicOutputValidator.reference

Definition at line 390 of file GaudiTest.py.

◆ result_key

GaudiTest.BasicOutputValidator.result_key

Definition at line 392 of file GaudiTest.py.


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