@@ -98,9 +98,11 @@ def write_history_nodes(self):
9898
9999# histNodes = self.root.SubElement(self.root, "historyNodes")
100100
101+ have_hist_nodes = False
101102 for i ,h in enumerate (self .db .getHistoryNodes (HistoryNodeKind .ALL )):
102103 histN = self .mkElem (self .root , "historyNodes" )
103104 histN .set ("historyNodeId" , str (i ))
105+ have_hist_nodes = True
104106
105107 # TODO: parent
106108 histN .set ("logicalName" , h .getLogicalName ())
@@ -125,6 +127,35 @@ def write_history_nodes(self):
125127 self .setAttr (histN , "vendorToolVersion" , h .getVendorToolVersion ())
126128 self .setIfNonNeg (histN , "sameTests" , h .getSameTests ())
127129 self .setIfNonNull (histN , "comment" , h .getComment ())
130+
131+ if not have_hist_nodes :
132+ # XML requires history nodes, so add a dummy history node
133+ histN = self .mkElem (self .root , "historyNodes" )
134+ histN .set ("historyNodeId" , str (0 ))
135+
136+ histN .set ("logicalName" , "dummy" )
137+ self .setIfNonNull (histN , "physicalName" , "dummy" )
138+ self .setIfNonNull (histN , "kind" , "dummy" )
139+ self .setAttrBool (histN , "testStatus" , True )
140+ self .setIfNonNeg (histN , "simtime" , 0 )
141+ self .setIfNonNull (histN , "timeunit" , 0 )
142+ self .setIfNonNull (histN , "runCwd" , "" )
143+ self .setIfNonNeg (histN , "cpuTime" , 0 )
144+ self .setIfNonNull (histN , "seed" , 0 )
145+ self .setIfNonNull (histN , "cmd" , "" )
146+ self .setIfNonNull (histN , "args" , "" )
147+ # self.setIfNonNull(histN, "compulsory", h.getCompulsory())
148+ self .setAttrDateTime (histN , "date" , datetime .now ().strftime ("%Y%m%d%H%M%S" ))
149+ self .setIfNonNull (histN , "userName" , "dummy" )
150+ # self.setIfNonNeg(histN, "cost", h.getCost())
151+ self .setAttr (histN , "toolCategory" , "unknown" )
152+ self .setAttr (histN , "ucisVersion" , "1.0" )
153+ self .setAttr (histN , "vendorId" , "unknown" )
154+ self .setAttr (histN , "vendorTool" , "PyUCIS" )
155+ self .setAttr (histN , "vendorToolVersion" , "unknown" )
156+ # self.setIfNonNeg(histN, "sameTests", h.getSameTests())
157+ # self.setIfNonNull(histN, "comment", h.getComment())
158+
128159
129160 # TODO: userAttr
130161
0 commit comments