def testIterate(self):
"""
Test that reactor.iterate(0) doesn't block
"""
start = time.time()
# twisted timers are distinct from the underlying event loop's
# timers, so this fail-safe probably won't keep a failure from
# hanging the test
t = reactor.callLater(10, reactor.crash)
reactor.iterate(0) # shouldn't block
stop = time.time()
elapsed = stop - start
#print "elapsed", elapsed
self.failUnless(elapsed < 8)
t.cancel()
评论列表
文章目录