Redirect error output properly during unit testing
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Tue, 19 May 2009 16:54:13 +0000 (18:54 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Tue, 19 May 2009 16:54:13 +0000 (18:54 +0200)
Cython/TestUtils.py

index 9ed1b3b37d73f58740e3330b1b92bf135bf285f8..cd888dc0e6cbb6ecf0fcaa268d9582d7a1d536d5 100644 (file)
@@ -38,6 +38,15 @@ def treetypes(root):
 
 class CythonTest(unittest.TestCase):
 
+    def setUp(self):
+        self.listing_file = Errors.listing_file
+        self.echo_file = Errors.echo_file
+        Errors.listing_file = Errors.echo_file = None
+    def tearDown(self):
+        Errors.listing_file = self.listing_file
+        Errors.echo_file = self.echo_file
     def assertLines(self, expected, result):
         "Checks that the given strings or lists of strings are equal line by line"
         if not isinstance(expected, list): expected = expected.split(u"\n")