Rev 5273: Just pass the exception object to simplify. in file:///home/vila/src/bzr/experimental/leaking-tests/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 7 15:05:19 BST 2010


At file:///home/vila/src/bzr/experimental/leaking-tests/

------------------------------------------------------------
revno: 5273
revision-id: v.ladeuil+lp at free.fr-20100607140519-b4jdekuz1ln9ocy8
parent: v.ladeuil+lp at free.fr-20100607132143-iv6psj3i3spiphqd
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: propagate-exceptions
timestamp: Mon 2010-06-07 16:05:19 +0200
message:
  Just pass the exception object to simplify.
  
  * bzrlib/tests/test_server.py:
  (ThreadWithException.set_ignored_exceptions)
  (ThreadWithException.join): Simplified.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_server.py'
--- a/bzrlib/tests/test_server.py	2010-06-07 13:21:43 +0000
+++ b/bzrlib/tests/test_server.py	2010-06-07 14:05:19 +0000
@@ -265,15 +265,13 @@
            - an exception class: the instances of this class will be ignored,
            - a tuple of exception classes: the instances of any class of the
              list will be ignored,
-           - a callable: that will be passed exc_class, exc_value
+           - a callable: that will be passed the exception object
              and should return True if the exception should be ignored
         """
         if ignored is None:
             self.ignored_exceptions = None
-        elif isinstance(ignored, Exception):
-            self.ignored_exceptions = lambda c, v: c is ignored
-        elif isinstance(ignored, tuple):
-            self.ignored_exceptions = lambda c, v: isinstance(v, ignored)
+        elif isinstance(ignored, (Exception, tuple)):
+            self.ignored_exceptions = lambda e: isinstance(e, ignored)
         else:
             self.ignored_exceptions = ignored
 
@@ -304,7 +302,7 @@
             exc_class, exc_value, exc_tb = self.exception
             self.exception = None # The exception should be raised only once
             if (self.ignored_exceptions is None
-                or not self.ignored_exceptions(exc_class, exc_value)):
+                or not self.ignored_exceptions(exc_value)):
                 # Raise non ignored exceptions
                 raise exc_class, exc_value, exc_tb
         if timeout and self.isAlive():



More information about the bazaar-commits mailing list