Go to the documentation of this file.
20 BaseTest.__init__(self)
27 Parse a QMTest XML test description (.qmt file) to initialize the test
30 from string
import Template
32 log = logging.getLogger(
"QMTest.XMLParser")
33 import xml.etree.ElementTree
as ET
35 log.debug(
"parsing %s", path)
38 os.path.relpath(path, self.
basedir)
45 for child
in tree.getroot():
46 name = child.attrib[
"name"]
47 if hasattr(self, name):
48 log.debug(
"setting %s", name)
50 if name
in (
"args",
"unsupported_platforms"):
51 setattr(self, name, [el.text
for el
in value.findall(
"text")])
52 elif name ==
"environment":
53 for el
in value.findall(
"text"):
54 key, value = el.text.split(
"=", 1)
55 self.
environment[key] = Template(value).safe_substitute(
61 if value.tag ==
"integer":
63 setattr(self, name, data)
68 class CallWrapper(object):
70 Small wrapper class to dynamically bind some default arguments
74 def __init__(self, callable, extra_args={}):
80 from inspect
import getargspec
88 for param
in inspect.signature(callable).parameters.values()
89 if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
96 def __call__(self, *args, **kwargs):
100 kwargs = dict(kwargs)
104 if a
not in positional
and a
not in kwargs:
106 return self.
callable(*args, **kwargs)
117 "reference": stdout_ref,
118 "error_reference": stderr_ref,
119 "findReferenceBlock": CallWrapper(
121 {
"stdout": stdout,
"result": result,
"causes": self.
causes},
123 "validateWithReference": CallWrapper(
132 "validateJSONWithReference": CallWrapper(
139 "countErrorLines": CallWrapper(
141 {
"stdout": stdout,
"result": result,
"causes": self.
causes},
143 "checkTTreesSummaries": CallWrapper(
145 {
"stdout": stdout,
"result": result,
"causes": self.
causes},
147 "checkHistosSummaries": CallWrapper(
149 {
"stdout": stdout,
"result": result,
"causes": self.
causes},
153 exec(self.
validator, globals(), exported_symbols)
154 return result, self.
causes
156 return super(QMTTest, self).
ValidateOutput(stdout, stderr, result)
def CheckHistosSummaries(self, stdout=None, result=None, causes=None, dict=None, ignore=None)
def validateWithReference(self, stdout=None, stderr=None, result=None, causes=None, preproc=None)
def validateJSONWithReference(self, output_file, reference_file, result=None, causes=None, detailed=True)
def ValidateOutput(self, stdout, stderr, result)
def _expandReferenceFileName(self, reffile)
def findReferenceBlock(self, reference=None, stdout=None, result=None, causes=None, signature_offset=0, signature=None, id=None)
def CheckTTreesSummaries(self, stdout=None, result=None, causes=None, trees_dict=None, ignore=r"Basket|.*size|Compression")
def countErrorLines(self, expected={"ERROR":0, "FATAL":0}, stdout=None, result=None, causes=None)
def XMLParser(self, path)
def __init__(self, path=None)