[asterisk-commits] mnicholson: branch mnicholson/failure-message r2442 - /asterisk/team/mnichols...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 23 15:42:12 CDT 2011


Author: mnicholson
Date: Fri Sep 23 15:42:08 2011
New Revision: 2442

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2442
Log:
tweaks

Modified:
    asterisk/team/mnicholson/failure-message/generate-results-xml.py

Modified: asterisk/team/mnicholson/failure-message/generate-results-xml.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mnicholson/failure-message/generate-results-xml.py?view=diff&rev=2442&r1=2441&r2=2442
==============================================================================
--- asterisk/team/mnicholson/failure-message/generate-results-xml.py (original)
+++ asterisk/team/mnicholson/failure-message/generate-results-xml.py Fri Sep 23 15:42:08 2011
@@ -17,16 +17,15 @@
             illegal.append(chr(i))
     return data.translate(None, ''.join(illegal))
 
-def testcase(name, failure = None):
+def testcase(parent, name, failure = None):
     tc = doc.createElement("testcase")
+    parent.appendChild(tc)
     tc.setAttribute("time", "1.0")
     tc.setAttribute("name", name)
     if failure:
         f = doc.createElement("failure")
         f.appendChild(doc.createTextNode(strip_illegal_xml_chars(failure)))
         tc.appendChild(f)
-
-    return tc
 
 dom = xml.dom.getDOMImplementation()
 doc = dom.createDocument(None, "testsuite", None)
@@ -39,9 +38,10 @@
 ts.setAttribute("name", "xml test")
 
 
-ts.appendChild(testcase("legal1"))
-ts.appendChild(testcase("escape1", "let's see if this get's escaped <> \" \' & ;"))
-ts.appendChild(testcase("stripped1", "going to drop some illegal chars in here  " + chr(0) + " and they should get stripped out"))
+testcase(ts, "legal1")
+testcase(ts, "escape1", "let's see if this get's escaped <> \" \' & ;")
+testcase(ts, "stripped1", "going to drop some illegal chars in here  " + chr(0) + " and they should get stripped out")
 
 doc.writexml(open('results.xml', 'w'), encoding = "utf-8")
+print doc.toprettyxml("    ", encoding = "utf-8")
 




More information about the asterisk-commits mailing list