'If the function called by L{utils.runWithWarningsSuppressed} returns a
C{Deferred}, the warning filters aren\'t removed until the Deferred
fires with an errback.'

def test_deferredErrback(self):

    filters = [(('ignore', '.*foo.*'), {}), (('ignore', '.*bar.*'), {})]
    result = Deferred()
    d = self.runWithWarningsSuppressed(filters, (lambda : result))
    warnings.warn('ignore    foo')
    result.errback(ZeroDivisionError())
    d.addErrback((lambda f: f.trap(ZeroDivisionError)))
    warnings.warn('ignore    foo    2')
    self.assertEqual(['ignore    foo    2'], [w['message'] for w in self.flushWarnings()])
