當前位置: 首頁>>代碼示例>>Python>>正文


Python DeferredPool.status方法代碼示例

本文整理匯總了Python中buildbot.util.deferredpool.DeferredPool.status方法的典型用法代碼示例。如果您正苦於以下問題:Python DeferredPool.status方法的具體用法?Python DeferredPool.status怎麽用?Python DeferredPool.status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在buildbot.util.deferredpool.DeferredPool的用法示例。


在下文中一共展示了DeferredPool.status方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testNotifyWhenPoolEmpties

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testNotifyWhenPoolEmpties(self):
     """
     After all the deferreds in a pool fire, it should call all notify
     callbacks.
     """
     pool = DeferredPool()
     d1 = defer.Deferred()
     d2 = defer.Deferred()
     d3 = defer.Deferred()
     pool.add(d1)
     pool.add(d2)
     pool.add(d3)
     # There must be 3 deferreds underway.
     self.assertEqual(pool.status(), (3, 0))
     wait1 = pool.notifyWhenEmpty()
     wait2 = pool.notifyWhenEmpty()
     # There must be 3 deferreds underway and 2 waiting.
     self.assertEqual(pool.status(), (3, 2))
     d1.callback(None)
     d2.callback(None)
     # There must be 1 deferreds underway and 2 waiting.
     self.assertEqual(pool.status(), (1, 2))
     # The waiters must not have fired yet.
     self.assertEqual(wait1.called, False)
     self.assertEqual(wait2.called, False)
     d3.callback(None)
     # Both waiters must have fired (with None) & the pool must be empty.
     self.assertEqual(wait1.called, True)
     self.assertEqual(wait2.called, True)
     self.assertEqual(pool.status(), (0, 0))
     self.assertEqual(wait1.result, None)
     self.assertEqual(wait2.result, None)
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:34,代碼來源:test_util_deferredpool.py

示例2: testPoolStatusAfterDeferredIsCallbacked

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolStatusAfterDeferredIsCallbacked(self):
     """
     The pool must correctly report how many deferreds are underway
     and how many are waiting for it to drain after one of its underway
     deferreds is callbacked.
     """
     pool = DeferredPool()
     d = defer.Deferred()
     pool.add(d)
     pool.add(defer.Deferred())
     self.assertEqual(pool.status(), (2, 0))
     d.callback(None)
     self.assertEqual(pool.status(), (1, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:15,代碼來源:test_util_deferredpool.py

示例3: testPoolStatusAfterDeferredIsErrbacked

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolStatusAfterDeferredIsErrbacked(self):
     """
     The pool must correctly report how many deferreds are underway
     and how many are waiting for it to drain after one of its underway
     deferreds is errbacked.
     """
     pool = DeferredPool()
     d = defer.Deferred()
     d.addErrback(lambda _: True)
     pool.add(d)
     pool.add(defer.Deferred())
     self.assertEqual(pool.status(), (2, 0))
     d.errback(Exception())
     self.assertEqual(pool.status(), (1, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:16,代碼來源:test_util_deferredpool.py

示例4: testEmptyPoolStatus

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testEmptyPoolStatus(self):
     """
     A newly created (empty) pool should have no deferreds in progress
     and no deferreds waiting for the pool to drain.
     """
     pool = DeferredPool()
     self.assertEqual(pool.status(), (0, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:9,代碼來源:test_util_deferredpool.py

示例5: testPoolEmpties

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolEmpties(self):
     """
     If all the deferreds in a pool fire, its underway list should be empty.
     """
     pool = DeferredPool()
     d1 = defer.Deferred()
     d2 = defer.Deferred()
     d3 = defer.Deferred()
     pool.add(d1)
     pool.add(d2)
     pool.add(d3)
     self.assertEqual(pool.status(), (3, 0))
     d1.callback(None)
     d2.callback(None)
     d3.callback(None)
     self.assertEqual(pool.status(), (0, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:18,代碼來源:test_util_deferredpool.py

示例6: testPoolDeferredCount

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolDeferredCount(self):
     """
     The pool must correctly report how many deferreds it has underway.
     """
     pool = DeferredPool()
     pool.add(defer.Deferred())
     pool.add(defer.Deferred())
     self.assertEqual(pool.status(), (2, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:10,代碼來源:test_util_deferredpool.py

示例7: testPoolWaitingCount

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolWaitingCount(self):
     """
     The pool must correctly report how many deferreds are waiting
     for it to drain.
     """
     pool = DeferredPool()
     pool.notifyWhenEmpty(testImmediately=False)
     pool.notifyWhenEmpty(testImmediately=False)
     self.assertEqual(pool.status(), (0, 2))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:11,代碼來源:test_util_deferredpool.py

示例8: testPoolStatus

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testPoolStatus(self):
     """
     The pool must correctly report how many deferreds are underway
     and how many are waiting for it to drain.
     """
     pool = DeferredPool()
     pool.add(defer.Deferred())
     pool.add(defer.Deferred())
     pool.notifyWhenEmpty(testImmediately=False)
     self.assertEqual(pool.status(), (2, 1))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:12,代碼來源:test_util_deferredpool.py

示例9: testEmptyPoolWithTestImmediatelyFalse

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testEmptyPoolWithTestImmediatelyFalse(self):
     """
     If the pool is empty and C{testImmediately} is C{False} when
     calling L{notifyWhenEmpty}, the returned deferred must not have
     already fired and the pool should contain one waiting deferred.
     """
     pool = DeferredPool()
     d = pool.notifyWhenEmpty(testImmediately=False)
     self.assertEqual(d.called, False)
     self.assertEqual(pool.status(), (0, 1))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:12,代碼來源:test_util_deferredpool.py

示例10: testEmptyPoolWithTestImmediatelyTrue

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testEmptyPoolWithTestImmediatelyTrue(self):
     """
     If the pool is empty and C{testImmediately} is C{True} when
     calling L{notifyWhenEmpty}, an already fired (with C{None} result)
     deferred must be returned and the pool should be empty.
     """
     pool = DeferredPool()
     d = pool.notifyWhenEmpty(testImmediately=True)
     self.assertEqual(d.called, True)
     self.assertEqual(d.result, None)
     self.assertEqual(pool.status(), (0, 0))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:13,代碼來源:test_util_deferredpool.py

示例11: testNonEmptyPoolWithTestImmediatelyTrue

# 需要導入模塊: from buildbot.util.deferredpool import DeferredPool [as 別名]
# 或者: from buildbot.util.deferredpool.DeferredPool import status [as 別名]
 def testNonEmptyPoolWithTestImmediatelyTrue(self):
     """
     If the pool is not empty and C{testImmediately} is C{True} when
     calling L{notifyWhenEmpty}, the returned deferred must not have
     already fired and the pool should contain one underway deferred
     and one waiting.
     """
     pool = DeferredPool()
     pool.add(defer.Deferred())
     d = pool.notifyWhenEmpty(testImmediately=True)
     self.assertEqual(d.called, False)
     self.assertEqual(pool.status(), (1, 1))
開發者ID:aelsabbahy,項目名稱:buildbot,代碼行數:14,代碼來源:test_util_deferredpool.py


注:本文中的buildbot.util.deferredpool.DeferredPool.status方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。