Commit f5286a84 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Allowed to inherit from default QMTTest object

One can now set GAUDI_QMTEST_MODULE and GAUDI_QMTEST_CLASS to overwrite the default python object used to instantiate qmt tests.
This allows to have dedicated objects, e.g. experiment specific, checking some specialized output in a different way
parent b69a966b
......@@ -142,9 +142,18 @@ def main():
fileToExec = imp.Test()
results = fileToExec.run()
elif filename.endswith(".qmt"):
from QMTTest import QMTTest
fileToTest = QMTTest(filename)
results = fileToTest.run()
# Check which class should be used to instantiate QMTests
# by default it is QMTTest but this can be overwritten via the environment
try:
test_module = os.environ.get('GAUDI_QMTEST_MODULE', 'GaudiTesting.QMTTest')
test_class = os.environ.get('GAUDI_QMTEST_CLASS', 'QMTTest')
exec 'from {} import {} as test_class'.format(test_module, test_class)
fileToTest = test_class(filename)
results = fileToTest.run()
except Exception, e:
logging.error('Exception caught when trying to instantiate qmt test python object')
logging.error(e)
return 1
report = globals()[opts.report + '_report']
report(results)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment