changeset 121:381233a91db6

Fix for the {{{unittest}}} command, which was raising an exception but swallowing the traceback.
author cmlenz
date Mon, 08 Aug 2005 15:42:03 +0000
parents b63ed684c29c
children 0dafd12f6f5f
files bitten/util/testrunner.py bitten/util/xmlio.py
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/util/testrunner.py
+++ b/bitten/util/testrunner.py
@@ -53,10 +53,12 @@
         sys.stdout, sys.stderr = self.buf_stdout, self.buf_stderr
 
     def stopTest(self, test):
-        _TextTestResult.stopTest(self, test)
         self.tests[-1][2] = time.time() - self.tests[-1][2]
         self.tests[-1][3] = self.buf_stdout.getvalue()
         self.tests[-1][4] = self.buf_stderr.getvalue()
+        sys.stdout, sys.stderr = self.orig_stdout, self.orig_stderr
+
+        _TextTestResult.stopTest(self, test)
 
 
 class XMLTestRunner(TextTestRunner):
--- a/bitten/util/xmlio.py
+++ b/bitten/util/xmlio.py
@@ -131,14 +131,14 @@
     """
     __slots__ = ['name', 'attr']
 
-    def __init__(self, *args, **attr):
+    def __init__(self, name_, **attr):
         """Create an XML element using the specified tag name.
         
         The tag name must be supplied as the first positional argument. All
         keyword arguments following it are handled as attributes of the element.
         """
         Fragment.__init__(self)
-        self.name = args[0]
+        self.name = name_
         self.attr = dict([(name, value) for name, value in attr.items()
                           if value is not None])
 
@@ -164,7 +164,7 @@
 
     __slots__ = []
 
-    def __init__(self, parent, name, **attr):
+    def __init__(self, parent_, name_, **attr):
         """Create an XML element using the specified tag name.
         
         The first positional argument is the instance of the parent element that
@@ -172,8 +172,8 @@
         the name of the tag. All keyword arguments are handled as attributes of
         the element.
         """
-        Element.__init__(self, name, **attr)
-        parent.append(self)
+        Element.__init__(self, name_, **attr)
+        parent_.append(self)
 
 
 def parse(text):
Copyright (C) 2012-2017 Edgewall Software