GaudiTesting.QMTTest.QMTTest Class Reference
Inheritance diagram for GaudiTesting.QMTTest.QMTTest:
Collaboration diagram for GaudiTesting.QMTTest.QMTTest:

Public Member Functions

def __init__
 
def XMLParser (self, path)
 
def ValidateOutput (self, stdout, stderr, result)
 
def __init__
 
def XMLParser (self, path)
 
def ValidateOutput (self, stdout, stderr, result)
 
- Public Member Functions inherited from GaudiTesting.BaseTest.BaseTest
def __init__ (self)
 
def validator
 
def run (self)
 
def ValidateOutput (self, stdout, stderr, result)
 
def findReferenceBlock
 
def countErrorLines
 
def CheckTTreesSummaries
 
def CheckHistosSummaries
 
def validateWithReference
 
def __init__ (self)
 
def validator
 
def run (self)
 
def ValidateOutput (self, stdout, stderr, result)
 
def findReferenceBlock
 
def countErrorLines
 
def CheckTTreesSummaries
 
def CheckHistosSummaries
 
def validateWithReference
 

Public Attributes

 validator
 
 name
 
 callable
 
 extra_args
 
 args_order
 
 stderr
 
- Public Attributes inherited from GaudiTesting.BaseTest.BaseTest
 program
 
 args
 
 reference
 
 error_reference
 
 options
 
 stderr
 
 timeout
 
 exit_code
 
 environment
 
 unsupported_platforms
 
 signal
 
 workdir
 
 use_temp_dir
 
 status
 
 name
 
 causes
 
 result
 
 returnedCode
 
 out
 
 err
 
 proc
 
 stack_trace
 
 basedir
 

Detailed Description

Definition at line 7 of file QMTTest.py.

Constructor & Destructor Documentation

def GaudiTesting.QMTTest.QMTTest.__init__ (   self,
  path = None 
)

Definition at line 9 of file QMTTest.py.

9  def __init__(self, path=None):
10  BaseTest.__init__(self)
11  self.validator = ''
12  if path:
13  self.XMLParser(path)
14 
def XMLParser(self, path)
Definition: QMTTest.py:15
def GaudiTesting.QMTTest.QMTTest.__init__ (   self,
  path = None 
)

Definition at line 9 of file QMTTest.py.

9  def __init__(self, path=None):
10  BaseTest.__init__(self)
11  self.validator = ''
12  if path:
13  self.XMLParser(path)
14 
def XMLParser(self, path)
Definition: QMTTest.py:15

Member Function Documentation

def GaudiTesting.QMTTest.QMTTest.ValidateOutput (   self,
  stdout,
  stderr,
  result 
)

Definition at line 46 of file QMTTest.py.

46  def ValidateOutput(self, stdout, stderr, result):
47  if self.validator:
48  class CallWrapper(object):
49  """
50  Small wrapper class to dynamically bind some default arguments
51  to a callable.
52  """
53  def __init__(self, callable, extra_args = {}):
54  self.callable = callable
55  self.extra_args = extra_args
56  # get the list of names of positional arguments
57  from inspect import getargspec
58  self.args_order = getargspec(callable)[0]
59  # Remove "self" from the list of positional arguments
60  # since it is added automatically
61  if self.args_order[0] == "self":
62  del self.args_order[0]
63  def __call__(self, *args, **kwargs):
64  # Check which positional arguments are used
65  positional = self.args_order[:len(args)]
66 
67  kwargs = dict(kwargs) # copy the arguments dictionary
68  for a in self.extra_args:
69  # use "extra_args" for the arguments not specified as
70  # positional or keyword
71  if a not in positional and a not in kwargs:
72  kwargs[a] = self.extra_args[a]
73  return apply(self.callable, args, kwargs)
74 
75  # local names to be exposed in the script
76  exported_symbols = {"self":self,
77  "stdout":stdout,
78  "stderr":stderr,
79  "result":result,
80  "causes":self.causes,
81  "findReferenceBlock":
82  CallWrapper(self.findReferenceBlock, {"stdout":stdout,
83  "result":result,
84  "causes":self.causes}),
85  "validateWithReference":
86  CallWrapper(self.validateWithReference, {"stdout":stdout,
87  "stderr":stderr,
88  "result":result,
89  "causes":self.causes}),
90  "countErrorLines":
91  CallWrapper(self.countErrorLines, {"stdout":stdout,
92  "result":result,
93  "causes":self.causes}),
94  "checkTTreesSummaries":
95  CallWrapper(self.CheckTTreesSummaries, {"stdout":stdout,
96  "result":result,
97  "causes":self.causes}),
98  "checkHistosSummaries":
99  CallWrapper(self.CheckHistosSummaries, {"stdout":stdout,
100  "result":result,
101  "causes":self.causes})
102  }
103  #print self.validator
104  exec self.validator in globals(), exported_symbols
105  else:
106  if self.stderr == '':
107  self.validateWithReference(stdout, stderr, result, self.causes)
108  elif stderr.strip() != self.stderr.strip():
109  self.causes.append('standard error')
110 
111  return result, self.causes
def GaudiTesting.QMTTest.QMTTest.ValidateOutput (   self,
  stdout,
  stderr,
  result 
)

Definition at line 46 of file QMTTest.py.

46  def ValidateOutput(self, stdout, stderr, result):
47  if self.validator:
48  class CallWrapper(object):
49  """
50  Small wrapper class to dynamically bind some default arguments
51  to a callable.
52  """
53  def __init__(self, callable, extra_args = {}):
54  self.callable = callable
55  self.extra_args = extra_args
56  # get the list of names of positional arguments
57  from inspect import getargspec
58  self.args_order = getargspec(callable)[0]
59  # Remove "self" from the list of positional arguments
60  # since it is added automatically
61  if self.args_order[0] == "self":
62  del self.args_order[0]
63  def __call__(self, *args, **kwargs):
64  # Check which positional arguments are used
65  positional = self.args_order[:len(args)]
66 
67  kwargs = dict(kwargs) # copy the arguments dictionary
68  for a in self.extra_args:
69  # use "extra_args" for the arguments not specified as
70  # positional or keyword
71  if a not in positional and a not in kwargs:
72  kwargs[a] = self.extra_args[a]
73  return apply(self.callable, args, kwargs)
74 
75  # local names to be exposed in the script
76  exported_symbols = {"self":self,
77  "stdout":stdout,
78  "stderr":stderr,
79  "result":result,
80  "causes":self.causes,
81  "findReferenceBlock":
82  CallWrapper(self.findReferenceBlock, {"stdout":stdout,
83  "result":result,
84  "causes":self.causes}),
85  "validateWithReference":
86  CallWrapper(self.validateWithReference, {"stdout":stdout,
87  "stderr":stderr,
88  "result":result,
89  "causes":self.causes}),
90  "countErrorLines":
91  CallWrapper(self.countErrorLines, {"stdout":stdout,
92  "result":result,
93  "causes":self.causes}),
94  "checkTTreesSummaries":
95  CallWrapper(self.CheckTTreesSummaries, {"stdout":stdout,
96  "result":result,
97  "causes":self.causes}),
98  "checkHistosSummaries":
99  CallWrapper(self.CheckHistosSummaries, {"stdout":stdout,
100  "result":result,
101  "causes":self.causes})
102  }
103  #print self.validator
104  exec self.validator in globals(), exported_symbols
105  else:
106  if self.stderr == '':
107  self.validateWithReference(stdout, stderr, result, self.causes)
108  elif stderr.strip() != self.stderr.strip():
109  self.causes.append('standard error')
110 
111  return result, self.causes
def GaudiTesting.QMTTest.QMTTest.XMLParser (   self,
  path 
)
Parse a QMTest XML test description (.qmt file) to initialize the test
instance.

Definition at line 15 of file QMTTest.py.

15  def XMLParser(self, path) :
16  '''
17  Parse a QMTest XML test description (.qmt file) to initialize the test
18  instance.
19  '''
20  log = logging.getLogger('QMTest.XMLParser')
21  import xml.etree.ElementTree as ET
22  log.debug('parsing %s', path)
23 
24  self.name = path
25 
26  tree = ET.parse(path)
27  for child in tree.getroot():
28  name = child.attrib['name']
29  if hasattr(self, name):
30  log.debug('setting %s', name)
31  value = child[0]
32  if name in ('args', 'unsupported_platforms'):
33  setattr(self, name, [el.text
34  for el in value.findall('text')])
35  elif name == 'environment':
36  setattr(self, name, dict(el.text.split('=', 1)
37  for el in value.findall('text')))
38  else:
39  data = value.text
40  if data is not None:
41  if value.tag == 'integer':
42  data = int(data)
43  setattr(self, name, data)
44 
45 
def XMLParser(self, path)
Definition: QMTTest.py:15
def GaudiTesting.QMTTest.QMTTest.XMLParser (   self,
  path 
)
Parse a QMTest XML test description (.qmt file) to initialize the test
instance.

Definition at line 15 of file QMTTest.py.

15  def XMLParser(self, path) :
16  '''
17  Parse a QMTest XML test description (.qmt file) to initialize the test
18  instance.
19  '''
20  log = logging.getLogger('QMTest.XMLParser')
21  import xml.etree.ElementTree as ET
22  log.debug('parsing %s', path)
23 
24  self.name = path
25 
26  tree = ET.parse(path)
27  for child in tree.getroot():
28  name = child.attrib['name']
29  if hasattr(self, name):
30  log.debug('setting %s', name)
31  value = child[0]
32  if name in ('args', 'unsupported_platforms'):
33  setattr(self, name, [el.text
34  for el in value.findall('text')])
35  elif name == 'environment':
36  setattr(self, name, dict(el.text.split('=', 1)
37  for el in value.findall('text')))
38  else:
39  data = value.text
40  if data is not None:
41  if value.tag == 'integer':
42  data = int(data)
43  setattr(self, name, data)
44 
45 
def XMLParser(self, path)
Definition: QMTTest.py:15

Member Data Documentation

GaudiTesting.QMTTest.QMTTest.args_order

Definition at line 58 of file QMTTest.py.

GaudiTesting.QMTTest.QMTTest.callable

Definition at line 54 of file QMTTest.py.

GaudiTesting.QMTTest.QMTTest.extra_args

Definition at line 55 of file QMTTest.py.

GaudiTesting.QMTTest.QMTTest.name

Definition at line 24 of file QMTTest.py.

GaudiTesting.QMTTest.QMTTest.stderr

Definition at line 106 of file QMTTest.py.

GaudiTesting.QMTTest.QMTTest.validator

Definition at line 11 of file QMTTest.py.


The documentation for this class was generated from the following file:
  • InstallArea/x86_64-slc6-gcc48-opt/python/GaudiTesting/QMTTest.py