/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_server.py

  • Committer: Vincent Ladeuil
  • Date: 2010-06-07 14:05:19 UTC
  • mto: (5247.6.1 http-leaks)
  • mto: This revision was merged to the branch mainline in revision 5396.
  • Revision ID: v.ladeuil+lp@free.fr-20100607140519-b4jdekuz1ln9ocy8
Just pass the exception object to simplify.

* bzrlib/tests/test_server.py:
(ThreadWithException.set_ignored_exceptions)
(ThreadWithException.join): Simplified.

Show diffs side-by-side

added added

removed removed

Lines of Context:
265
265
           - an exception class: the instances of this class will be ignored,
266
266
           - a tuple of exception classes: the instances of any class of the
267
267
             list will be ignored,
268
 
           - a callable: that will be passed exc_class, exc_value
 
268
           - a callable: that will be passed the exception object
269
269
             and should return True if the exception should be ignored
270
270
        """
271
271
        if ignored is None:
272
272
            self.ignored_exceptions = None
273
 
        elif isinstance(ignored, Exception):
274
 
            self.ignored_exceptions = lambda c, v: c is ignored
275
 
        elif isinstance(ignored, tuple):
276
 
            self.ignored_exceptions = lambda c, v: isinstance(v, ignored)
 
273
        elif isinstance(ignored, (Exception, tuple)):
 
274
            self.ignored_exceptions = lambda e: isinstance(e, ignored)
277
275
        else:
278
276
            self.ignored_exceptions = ignored
279
277
 
304
302
            exc_class, exc_value, exc_tb = self.exception
305
303
            self.exception = None # The exception should be raised only once
306
304
            if (self.ignored_exceptions is None
307
 
                or not self.ignored_exceptions(exc_class, exc_value)):
 
305
                or not self.ignored_exceptions(exc_value)):
308
306
                # Raise non ignored exceptions
309
307
                raise exc_class, exc_value, exc_tb
310
308
        if timeout and self.isAlive():