From 95779ca72a20fcd52f386e029ad6b1a7b2cc2ad7 Mon Sep 17 00:00:00 2001 From: Frederic Peters Date: Sun, 29 Aug 2004 09:29:36 +0000 Subject: corretly escape xml --- python/tests/XmlTestRunner.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'python') 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 """ %s %s - """ % (test.id(), test.shortDescription()) + """ % (test.id(), xml(test.shortDescription())) def addError(self, test, err): unittest.TestResult.addError(self, test, err) print """ %s %s - """ % (test.id(), test.shortDescription()) + """ % (test.id(), xml(test.shortDescription())) # TODO: add err def addFailure(self, test, err): @@ -45,13 +48,9 @@ class XmlTestResult(unittest.TestResult): print """ %s %s - """ % (test.id(), test.shortDescription()) + """ % (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): -- cgit