[asterisk-commits] mnicholson: branch mnicholson/failure-message r2438 - /asterisk/team/mnichols...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 23 14:54:39 CDT 2011
Author: mnicholson
Date: Fri Sep 23 14:54:36 2011
New Revision: 2438
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2438
Log:
generate the results file using a python script
Added:
asterisk/team/mnicholson/failure-message/generate-results-xml.py (with props)
Modified:
asterisk/team/mnicholson/failure-message/test-xml.sh
Added: 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=auto&rev=2438
==============================================================================
--- asterisk/team/mnicholson/failure-message/generate-results-xml.py (added)
+++ asterisk/team/mnicholson/failure-message/generate-results-xml.py Fri Sep 23 14:54:36 2011
@@ -1,0 +1,33 @@
+#!/usr/bin/env python
+# vim: sw=4 et:
+
+import xml.dom
+
+def testcase(name, failure = None):
+ tc = doc.createElement("testcase")
+ tc.setAttribute("time", "1.0")
+ tc.setAttribute("name", name)
+ if failure:
+ f = doc.createElement("failure")
+ f.appendChild(doc.createTextNode(failure))
+ tc.appendChild(f)
+
+ return tc
+
+dom = xml.dom.getDOMImplementation()
+doc = dom.createDocument(None, "testsuite", None)
+
+ts = doc.documentElement
+ts.setAttribute("errors", "0")
+ts.setAttribute("tests", "3")
+ts.setAttribute("time", "5.0")
+ts.setAttribute("failures", "2")
+ts.setAttribute("name", "xml test")
+
+
+ts.appendChild(testcase("legal1"))
+ts.appendChild(testcase("escape1", "let's see if this get's escaped <> \" \' & ;"))
+ts.appendChild(testcase("illegal1", "going to drop some illegal chars in here\n bah, it just let it through"))
+
+doc.writexml(open('results.xml', 'w'), encoding = "utf-8")
+
Propchange: asterisk/team/mnicholson/failure-message/generate-results-xml.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mnicholson/failure-message/generate-results-xml.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mnicholson/failure-message/generate-results-xml.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/team/mnicholson/failure-message/test-xml.sh
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mnicholson/failure-message/test-xml.sh?view=diff&rev=2438&r1=2437&r2=2438
==============================================================================
--- asterisk/team/mnicholson/failure-message/test-xml.sh (original)
+++ asterisk/team/mnicholson/failure-message/test-xml.sh Fri Sep 23 14:54:36 2011
@@ -1,6 +1,4 @@
#!/bin/bash
-pwd
-cp results-template.xml results.xml
+python generate-results-xml.py
-exit
More information about the asterisk-commits
mailing list