The Gaudi Framework  master (594c33fa)
GaudiTesting.BaseTest.BasicOutputValidator Class Reference

Public Member Functions

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

Public Attributes

 ref
 
 cause
 
 result_key
 

Private Member Functions

def __CompareText (self, s1, s2)
 

Detailed Description

Definition at line 858 of file BaseTest.py.

Constructor & Destructor Documentation

◆ __init__()

def GaudiTesting.BaseTest.BasicOutputValidator.__init__ (   self,
  ref,
  cause,
  result_key 
)

Definition at line 859 of file BaseTest.py.

859  def __init__(self, ref, cause, result_key):
860  self.ref = ref
861  self.cause = cause
862  self.result_key = result_key
863 

Member Function Documentation

◆ __call__()

def GaudiTesting.BaseTest.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 864 of file BaseTest.py.

864  def __call__(self, out, result):
865  """Validate the output of the program.
866  'stdout' -- A string containing the data written to the standard output
867  stream.
868  'stderr' -- A string containing the data written to the standard error
869  stream.
870  'result' -- A 'Result' object. It may be used to annotate
871  the outcome according to the content of stderr.
872  returns -- A list of strings giving causes of failure."""
873 
874  causes = []
875  # Check the output
876  if not self.__CompareText(out, self.ref):
877  causes.append(self.cause)
878  result[self.result_key] = result.Quote(self.ref)
879 
880  return causes
881 

◆ __CompareText()

def GaudiTesting.BaseTest.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 882 of file BaseTest.py.

882  def __CompareText(self, s1, s2):
883  """Compare 's1' and 's2', ignoring line endings.
884  's1' -- A string.
885  's2' -- A string.
886  returns -- True if 's1' and 's2' are the same, ignoring
887  differences in line endings."""
888  if ROOT6WorkAroundEnabled("ReadRootmapCheck"):
889  # FIXME: (MCl) Hide warnings from new rootmap sanity check until we
890  # can fix them
891  to_ignore = re.compile(
892  r"Warning in <TInterpreter::ReadRootmapFile>: .* is already in .*"
893  )
894 
895  def keep_line(l):
896  return not to_ignore.match(l)
897 
898  return list(filter(keep_line, s1.splitlines())) == list(
899  filter(keep_line, s2.splitlines())
900  )
901  else:
902  return s1.splitlines() == s2.splitlines()
903 
904 
905 # ------------------------ Preprocessor elements ------------------------#

Member Data Documentation

◆ cause

GaudiTesting.BaseTest.BasicOutputValidator.cause

Definition at line 861 of file BaseTest.py.

◆ ref

GaudiTesting.BaseTest.BasicOutputValidator.ref

Definition at line 860 of file BaseTest.py.

◆ result_key

GaudiTesting.BaseTest.BasicOutputValidator.result_key

Definition at line 862 of file BaseTest.py.


The documentation for this class was generated from the following file:
GaudiTesting.BaseTest.ROOT6WorkAroundEnabled
def ROOT6WorkAroundEnabled(id=None)
Definition: BaseTest.py:769