diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2004-08-29 09:29:36 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2004-08-29 09:29:36 +0000 |
commit | 95779ca72a20fcd52f386e029ad6b1a7b2cc2ad7 (patch) | |
tree | 3d7f0d633196fe9cf8d51e20d4a3a43a69a9b0b9 /python | |
parent | a418f7ee029605bf86e3b717955e04b9854b6400 (diff) | |
download | lasso-95779ca72a20fcd52f386e029ad6b1a7b2cc2ad7.tar.gz lasso-95779ca72a20fcd52f386e029ad6b1a7b2cc2ad7.tar.xz lasso-95779ca72a20fcd52f386e029ad6b1a7b2cc2ad7.zip |
corretly escape xml
Diffstat (limited to 'python')
-rw-r--r-- | python/tests/XmlTestRunner.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/python/tests/XmlTestRunner.py b/python/tests/XmlTestRunner.py index 5d3efdfe..fe12e3fc 100644 --- a/python/tests/XmlTestRunner.py +++ b/python/tests/XmlTestRunner.py @@ -25,19 +25,22 @@ import unittest import time import sys +def xml(text): + return text.replace('&', '&').replace('<', '<').replace('>', '>') + class XmlTestResult(unittest.TestResult): def addSuccess(self, test): print """ <test result="success"> <id>%s</id> <description>%s</description> - </test>""" % (test.id(), test.shortDescription()) + </test>""" % (test.id(), xml(test.shortDescription())) def addError(self, test, err): unittest.TestResult.addError(self, test, err) print """ <test result="error"> <id>%s</id> <description>%s</description> - </test>""" % (test.id(), test.shortDescription()) + </test>""" % (test.id(), xml(test.shortDescription())) # TODO: add err def addFailure(self, test, err): @@ -45,13 +48,9 @@ class XmlTestResult(unittest.TestResult): print """ <test result="failure"> <id>%s</id> <description>%s</description> - </test>""" % (test.id(), test.shortDescription()) + </test>""" % (test.id(), xml(test.shortDescription())) # TODO: add err - def shortDescription(self): - text = unittest.TestResult.shortDescription() - return text.replace('&', '&').replace('<', '<').replace('>', '>') - class XmlTestRunner: def _makeResult(self): |