12 from traceback
import format_exc
14 FILENAME = f
"{__name__}.root"
19 import GaudiConfig2.Configurables.Gaudi.Tests.Histograms.AxesLabels
as T
24 HistoAlgo = T.HistWithLabelsAlg
25 algs.append(HistoAlgo(
"HistoAlgo"))
27 svcs.append(C.Gaudi.Histograming.Sink.Root(FileName=FILENAME))
28 svcs.append(C.Gaudi.Monitoring.MessageSvcSink())
33 yield C.ApplicationMgr(
41 if os.path.exists(FILENAME):
46 result[
"root_output_file"] = FILENAME
48 if not os.path.exists(FILENAME):
49 causes.append(
"missing histogram file")
54 f = ROOT.TFile.Open(FILENAME)
55 h = f.Get(
"HistoAlgo/hist")
57 labels = list(axis.GetLabels())
58 expected = [
"a",
"b",
"c",
"d",
"e"]
59 if labels != expected:
60 causes.append(
"wrong axis labels")
61 result[
"expected_labels"] =
", ".join(repr(l)
for l
in expected)
62 result[
"found_labels"] =
", ".join(repr(l)
for l
in labels)
65 except Exception
as err:
66 causes.append(
"failure reading histogram file")
67 result[
"python_exception"] = result.Quote(format_exc())