예제 #1
0
 def tearDown(self):
     http._logDateTimeStop()
     if self.port1 is not None:
         d = self.port1.stopListening()
         unittest.wait(d)
     if self.port2 is not None:
         d = self.port2.stopListening()
         unittest.wait(d)
예제 #2
0
 def tearDown(self):
     http._logDateTimeStop()
     if self.port1 is not None:
         d = self.port1.stopListening()
         unittest.wait(d)
     if self.port2 is not None:
         d = self.port2.stopListening()
         unittest.wait(d)
예제 #3
0
    def _reentrantWait(self):
        def threadedOperation(n):
            time.sleep(n)
            return n

        d1 = threads.deferToThread(threadedOperation, 0.125)
        d2 = threads.deferToThread(threadedOperation, 0.250)
        d1.addCallback(lambda ignored: unittest.wait(d2))
        unittest.wait(d1)
예제 #4
0
    def testEveryIteration(self):
        ran = []

        def foo():
            ran.append(None)
            if len(ran) > 5:
                lc.stop()

        lc = task.LoopingCall(foo)
        d = lc.start(0)
        x = unittest.wait(d)
        self.assertEquals(len(ran), 6)
예제 #5
0
 def _cbDoWait(self, result):
     assertEquals(result, "Beginning")
     d = defer.succeed("End")
     assertEquals(unittest.wait(d), "End")
예제 #6
0
 def wait(self, d, timeout=10.0):
     return unittest.wait(d, timeout=timeout)
예제 #7
0
 def wait(self, d, timeout=10.0):
     return unittest.wait(d, timeout=timeout)