12 from traceback
import format_exc
14 FILENAME = f
"{__name__}.root"
15 FILENAMEJSON = f
"{__name__}.json"
20 import GaudiConfig2.Configurables.Gaudi.Tests.Histograms.AxesLabels
as T
25 HistoAlgo = T.HistWithLabelsAlg
26 algs.append(HistoAlgo(
"HistoAlgo"))
28 svcs.append(C.Gaudi.Histograming.Sink.Root(FileName=FILENAME))
29 svcs.append(C.Gaudi.Monitoring.JSONSink(FileName=FILENAMEJSON))
30 svcs.append(C.Gaudi.Monitoring.MessageSvcSink())
35 yield C.ApplicationMgr(
43 if os.path.exists(FILENAME):
48 result[
"root_output_file"] = FILENAME
50 if not os.path.exists(FILENAME):
51 causes.append(
"missing histogram file")
57 f = ROOT.TFile.Open(FILENAME)
58 h = f.Get(
"HistoAlgo/hist")
60 labels = list(axis.GetLabels())
61 expected = [
"a",
"b",
"c",
"d",
"e"]
62 if labels != expected:
63 causes.append(
"wrong axis labels")
64 result[
"expected_labels"] =
", ".join(repr(l)
for l
in expected)
65 result[
"found_labels"] =
", ".join(repr(l)
for l
in labels)
69 causes.append(
"failure reading histogram file")
70 result[
"python_exception"] = result.Quote(format_exc())