From: Zooko O'Whielacronx Date: Wed, 7 Jan 2009 15:13:42 +0000 (-0700) Subject: util: deferredutil: add basic test for deferredutil.gatherResults X-Git-Url: https://git.rkrishnan.org/vdrive//%22news.html/%22?a=commitdiff_plain;h=a54eba1d803b9b84dcd4df09eb576bfd1989ce84;p=tahoe-lafs%2Ftahoe-lafs.git util: deferredutil: add basic test for deferredutil.gatherResults Also I checked and Twisted 2.4.0 supports .subFailure and the other parts of the API that we require. --- diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index d69f8480..32abb7ef 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -356,6 +356,18 @@ class PollMixinTests(unittest.TestCase): return d class DeferredUtilTests(unittest.TestCase): + def test_gather_results(self): + d1 = defer.Deferred() + d2 = defer.Deferred() + res = deferredutil.gatherResults([d1, d2]) + d1.errback(ValueError("BAD")) + def _callb(res): + self.fail("Should have errbacked, not resulted in %s" % (res,)) + def _errb(thef): + thef.trap(ValueError) + res.addCallbacks(_callb, _errb) + return res + def test_success(self): d1, d2 = defer.Deferred(), defer.Deferred() good = []