[tahoe-lafs-trac-stream] [tahoe-lafs] #1852: test suite: find a way to prevent unclean reactor errors causing subsequent test failures

tahoe-lafs trac at tahoe-lafs.org
Sat Nov 10 02:36:54 UTC 2012


#1852: test suite: find a way to prevent unclean reactor errors causing subsequent
test failures
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  davidsarah
  davidsarah             |     Status:  new
         Type:  defect   |  Milestone:  undecided
     Priority:  normal   |    Version:  1.9.2
    Component:  code     |   Keywords:  test twisted-trial unclean reactor
   Resolution:           |  timeout hang
Launchpad Bug:           |
-------------------------+-------------------------------------------------

Comment (by davidsarah):

 Yes, it is:
 {{{

 import time

 from twisted.internet import reactor

 from allmydata.util import log
 from allmydata.util.pollmixin import PollMixin


 class WaitForDelayedCallsMixin(PollMixin):
     def _delayed_calls_done(self):
         # We're done when the only remaining DelayedCalls fire after
 threshold.
         # (These will be associated with the test timeout.)
         threshold = time.time() + 60
         for delayed in reactor._pendingTimedCalls +
 reactor._newTimedCalls:
             if delayed.getTime() < threshold:
                 return False
         return True

     def wait_for_delayed_calls(self, res):
         d = self.poll(self._delayed_calls_done)
         d.addErrback(log.err, "error while waiting for delayed calls")
         d.addBoth(lambda ign: res)
         return d
 }}}

-- 
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1852#comment:2>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list