[Twisted-Python] Trial Test Runner
    Markus Schiltknecht 
    markus at bluegap.ch
       
    Sat Nov 18 04:27:56 MST 2006
    
    
  
Hi,
Markus Schiltknecht wrote:
> OTOH, wouldn't it be sufficient to add setUp and tearDown methods for 
> TrialSuites? I'm investigating into that direction.
What speaks against something like that:
Index: runner.py
===================================================================
--- runner.py	(revision 18715)
+++ runner.py	(working copy)
@@ -142,10 +142,14 @@
          """
          # we implement this because Python 2.3 unittest defines this code
          # in __call__, whereas 2.4 defines the code in run.
+        if hasattr(self, 'setUp'):
+            self.setUp(self)
          for test in self._tests:
              if result.shouldStop:
                  break
              test(result)
+        if hasattr(self, 'tearDown'):
+            self.tearDown(self)
          return result
..and adding a setUp and tearDown method in the loader if the module has 
such methods?
Regards
Markus
    
    
More information about the Twisted-Python
mailing list